Running PHP7-FPM Nightly Build on Ubuntu 14.04

As I’m writing this, the calendar shows April 14 2015. According to the PHP 7.0 timeline, it has a projected release date of November 2015. But if you want to try it out (to check out the speed), you can already do so.

UPDATE: PHP 7 stable was released December 3, 2015.
You might want to use a stable version instead of nightlies,
so head over to How to upgrade to PHP 7 on Ubuntu.

This guide assumes you already know how to setup PHP5-FPM with your web server. You might want to setup that first and make sure it is running fine with your web server of choice.

Oh, and all commands are executed as root. Use sudo if you like to.

First of all, head on over to the PHP7 Nightly Builds page at Zend and download the ZIP for DEB.

$ wget

(The URL may or may not change, so check the above mentioned page first).

Zend also provides an installation guide for Ubuntu. It is missing documentation for installing as FPM, but we can at least use it as a starting point.

Install the required dependencies according to the Zend install guide mentioned (again, check the Zend page first):

$ apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libmcrypt-dev \
libxml2-dev \
libjpeg-dev \
libfreetype6-dev \
libmysqlclient-dev \
libt1-dev \
libgmp-dev \
libpspell-dev \
libicu-dev \

Then, unpack the archive. Note that the following command will unpack to /usr/local/php7 – Also note that the command on the Zend page uses an incorrect file name:

$ tar xzPf php-7*.tar.gz

Now you need to create your php-fpm.conf (use /usr/local/php7/etc/php-fpm.conf for your sanity). Use this as a starting point and adjust to your liking:

pid = /run/
error_log = /var/log/php7-fpm.log

user = nginx
group = nginx

listen =

pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6

Make sure the listen config does not collide with your php5-fpm config. Change port or socket file name if needed.

Next, you need the System V init script in /etc/init.d/php7-fpm. I took the php5-fpm script from Ondřej Surý as a basis and just fixed the paths to php7-fpm. Feel free to download it here and make it executable:

$ wget -O /etc/init.d/php7-fpm ""
$ chmod a+x /etc/init.d/php7-fpm

Then you need the init script in /etc/init/php7-fpm.conf. This one is also just an adaptation of Ondřej Surý’s script. Download from here.

$ wget -O /etc/init/php7-fpm.conf ""

You also need the checkconf script. Create the file /usr/local/lib/php7-fpm-checkconf and put this in it:

set -e
errors=$(/usr/local/php7/sbin/php-fpm --fpm-config /usr/local/php7/etc/php-fpm.conf -t 2>&1 | grep "\[ERROR\]" || true);
if [ -n "$errors" ]; then
    echo "Please fix your configuration file…"
    echo $errors
    exit 1
exit 0

Make it executable:

$ chmod a+x /usr/local/lib/php7-fpm-checkconf

Make sure php7-fpm starts when your system boots:

$ update-rc.d php7-fpm defaults

Start php7-fpm

$ service php7-fpm start

Have fun!


  1. Issue in your scripts!

    Manually typing everything you shown on this tutorial = Fail

    Copy and Paste every piece of code = Fail

    Copy & paste plus 1 hour debug = Works
    $ wget -O /etc/init/php7-fpm “”

    This snippet has an error or atleast using ubuntu 14.04 i got it working by moving the file /etc/init/php7-fpm to /etc/init/php7-fpm.conf

    Works properly now.

        1. Your setup is the standard one. I stand corrected, and have updated the post.
          Thank you!

  2. It’s in RC 4 release is their any different changes to install steps .
    and have you test WP is completely compatible with PHP7 .

    1. Zend publishes binaries of nightlies in both RPM and APT repositories now. You don’t have to compile nightlies of PHP7 yourself anymore:
      If you want RC4 specifically, instead of nightlies, you can download the source from here, and compile it yourself:

      WordPress is 100% compatible with PHP7 and will officially support it from the day PHP7 is released. This is not necessarily true for the plugins and themes you are using.

Comments are closed.