Compiling PHP 5.7 on Ubuntu

After noticing the big performance increase of PHP 5.7 Next Generation, I wanted to try it out myself. After 30 seconds my Digital Ocean VPS was ready to use:

Install some basic dependencies needed for successful compiling

aptitude install autoconf automake libtool re2c flex make libxml2-dev libssl-dev libbz2-dev libcurl3-dev libdb5.1-dev libjpeg-dev libpng-dev libXpm-dev libfreetype6-dev libt1-dev libgmp3-dev libc-client-dev libldap2-dev libmcrypt-dev libmhash-dev freetds-dev libz-dev libmysqlclient15-dev ncurses-dev libpcre3-dev unixODBC-dev libsqlite-dev libaspell-dev libreadline6-dev librecode-dev libsnmp-dev libtidy-dev libxslt-dev libt1-dev openssl openssl-dev libssl libssl-dev libxml2 libxml2-dev libpspell-dev libicu-dev

Compile Bison 2.4

tar -xzf bison-2.4.tar.gz
cd bison-2.4
make && make install
cd ../

Compile PHP 5.7

git clone
cd php-src
git branch phpng origin/phpng
git checkout phpng

./configure \
   --with-config-file-path=/etc \
   --enable-mbstring \
   --enable-zip \
   --enable-bcmath \
   --enable-pcntl \
   --enable-ftp \
   --enable-intl \
   --enable-exif \
   --enable-calendar \
   --enable-sysvmsg \
   --enable-sysvsem \
   --enable-sysvshm \
   --enable-wddx \
   --with-curl \
   --with-mcrypt \
   --with-iconv \
   --with-pspell \
   --with-gd \
   --with-jpeg-dir=/usr \
   --with-png-dir=/usr \
   --with-zlib-dir=/usr \
   --with-xpm-dir=/usr \
   --with-freetype-dir=/usr \
   --with-t1lib=/usr \
   --enable-gd-native-ttf \
   --enable-gd-jis-conv \
   --with-openssl \
   --with-mysql=/usr \
   --with-pdo-mysql=/usr \
   --with-gettext=/usr \
   --with-zlib=/usr \
   --with-bz2=/usr \
   --with-recode=/usr \

make install

Creating php.ini

php.ini should be created in /etc. I got some weird segfaults when opcode caching was enabled, so I commented it:


error_reporting = E_ALL & ~E_DEPRECATED
error_log = syslog

date.timezone = Europe/Brussels
date.default_latitude = 50.877369
date.default_longitude = 4.684167

To start the pool I created a quick and dirty bash file: This can be run in the background using nohup ./ &and starts a pool of 4 children. The fcgi-socket is located at /tmp/fcgi-php

PHP_FCGI_CHILDREN=4 PHP_FCGI_MAX_REQUESTS=0 php-cgi -b /tmp/fcgi-php

The result:

PHP 5.7.0-dev (cli) (built: Jul 17 2014 04:14:19)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.7.0-dev, Copyright (c) 1998-2014 Zend Technologies