How to install PHP 7 as PHP-FPM & FastCGI for ISPConfig 3 on Debian 8 (Jessie)

The final version of PHP 7 is available for download on Github and the PHP mirrors now. PHP7 is the next generation of the PHP programming language, it is up to 2 times faster than PHP 5.6 and 14 times faster than PHP 5.0 according to the release notes. The new PHP version is not 100% compatible with PHP 5.x as some deprecated API's have been removed, so it is a good idea to start testing your web sites for compatibility with this new release. This can be done easily and without affecting all sites on your server by using the multi PHP version feature in ISPConfig 3. The PHP version can be selected in the ISPConfig 3 website settings for each site individually. This feature works with PHP-FPM and FastCGI. This tutorial shows how to build the new PHP 7 as a PHP-FPM and a FastCGI version on a Debian Jessie server. These PHP 7 builds include Zend OPcache.

 

1 Preliminary Note

I will install PHP 7 that is currently in Beta at the time of this writing. Please note that PHP-FPM can be used on both Apache and Nginx servers while FastCGI is available only for Apache servers.

With older PHP versions, PHP-FPM and FastCGI had been mutually exclusive so that an FPM and FastCGI binary had to be build separately. With PHP 7, a single binary that support FPM and FCGI mode can be build.

 

2 Compile PHP 7 with PHP-FPM and Fastcgi

Download and extract PHP 7 from Github:

mkdir -p /opt/php-7.0.7
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget http://de1.php.net/get/php-7.0.7.tar.bz2/from/this/mirror -O php-7.0.7.tar.bz2
tar jxf php-7.0.7.tar.bz2

cd php-7.0.7/

Install the prerequisites for building PHP 7 and the nano editor that I will use to edit the config files:

apt-get install build-essential nano

apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-turbo-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6-dev libkrb5-dev libpq-dev libxml2-dev libxslt1-dev

ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a

(The last command is needed if you build PHP with --with-imap, because otherwise ./configure will stop with the following error:

checking for crypt in -lcrypt... yes
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
[email protected]:/usr/local/src/php5-build/php-7.0.7#

)

Configure and build PHP 7.0.0 as follows (you can adjust the ./configure command to your needs, take a look at

./configure --help

to see all available options; if you use a different ./configure command, it is possible that additional libraries are required, or the build process will fail):

./configure --prefix=/opt/php-7.0.7 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm

The last switch (--enable-fpm) makes sure this PHP version will work with PHP-FPM.

make
make install

Copy php.ini and php-fpm.conf to the correct locations:

cp /usr/local/src/php5-build/php-7.0.7/php.ini-production /opt/php-7.0.7/lib/php.ini

cp /opt/php-7.0.7/etc/php-fpm.conf.default /opt/php-7.0.7/etc/php-fpm.conf
cp /opt/php-7.0.7/etc/php-fpm.d/www.conf.default /opt/php-7.0.7/etc/php-fpm.d/www.conf

Open /opt/php-7.0.7/etc/php-fpm.conf and adjust the following setting (remove the ; in front of the pid line):

nano /opt/php-7.0.7/etc/php-fpm.conf

[...]
pid = run/php-fpm.pid
[...]

Then open /opt/php-7.0.7/etc/php-fpm.d/www.conf and adjust the listen line, you must use an unused port (e.g. 8999; port 9000 might be in use by Debian's default PHP-FPM already):

nano /opt/php-7.0.7/etc/php-fpm.d/www.conf

[...]
listen = 127.0.0.1:8999
[...]

3 Create the init script and systemd unit file

Debian supports Systemd as well as the traditional init scripts. First I will create an init script for the php-fpm service and then I will create a systemd unit.

First create an init script for PHP-FPM:

nano /etc/init.d/php-7.0.7-fpm

#! /bin/sh
### BEGIN INIT INFO
# Provides:          php-7.0.7-fpm
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-7.0.7-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-7.0.7/sbin/php-fpm
php_fpm_CONF=/opt/php-7.0.7/etc/php-fpm.conf
php_fpm_PID=/opt/php-7.0.7/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF"
wait_for_pid () {
        try=0
        while test $try -lt 35 ; do
                case "$1" in
                        'created')
                        if [ -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
                        'removed')
                        if [ ! -f "$2" ] ; then
                                try=''
                                break
                        fi
                        ;;
                esac
                echo -n .
                try=`expr $try + 1`
                sleep 1
        done
}
case "$1" in
        start)
                echo -n "Starting php-fpm "
                $php_fpm_BIN $php_opts
                if [ "$?" != 0 ] ; then
                        echo " failed"
                        exit 1
                fi
                wait_for_pid created $php_fpm_PID
                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;
        stop)
                echo -n "Gracefully shutting down php-fpm "
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
                kill -QUIT `cat $php_fpm_PID`
                wait_for_pid removed $php_fpm_PID
                if [ -n "$try" ] ; then
                        echo " failed. Use force-exit"
                        exit 1
                else
                        echo " done"
                       echo " done"
                fi
        ;;
        force-quit)
                echo -n "Terminating php-fpm "
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
                kill -TERM `cat $php_fpm_PID`
                wait_for_pid removed $php_fpm_PID
                if [ -n "$try" ] ; then
                        echo " failed"
                        exit 1
                else
                        echo " done"
                fi
        ;;
        restart)
                $0 stop
                $0 start
        ;;
        reload)
                echo -n "Reload service php-fpm "
                if [ ! -r $php_fpm_PID ] ; then
                        echo "warning, no pid file found - php-fpm is not running ?"
                        exit 1
                fi
                kill -USR2 `cat $php_fpm_PID`
                echo " done"
        ;;
        *)
                echo "Usage: $0 {start|stop|force-quit|restart|reload}"
                exit 1
        ;;
esac

Make the init script executable and create the system startup links:

chmod 755 /etc/init.d/php-7.0.7-fpm
insserv php-7.0.7-fpm

And now create the systemd unit file

nano /lib/systemd/system/php-7.0.7-fpm.service

with the follwoing content:

[Unit]
Description=The PHP 7 FastCGI Process Manager
After=network.target

[Service]
Type=simple
PIDFile=/opt/php-7.0.7/var/run/php-fpm.pid
ExecStart=/opt/php-7.0.7/sbin/php-fpm --nodaemonize --fpm-config /opt/php-7.0.7/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

Enable the service and reload systemd:

systemctl enable php-7.0.7-fpm.service
systemctl daemon-reload

Finally start PHP-FPM.

For systems with traditional init system, run:

/etc/init.d/php-7.0.7-fpm start

The result should be:

/etc/init.d/php-7.0.7-fpm start
Starting php-fpm done

On servers that use systemd, use this command instead:

systemctl start php-7.0.7-fpm.service

To enable the Zend OPcache, open /opt/php-7.0.7/lib/php.ini...

nano /opt/php-7.0.7/lib/php.ini

... and add the following line at the end:

[...]
zend_extension=opcache.so

The Memcache and APCu extension can not be installed on PHP 7 yet, so I will skip their installation for now. I will update the tutorial later when the pecl extensions are compatible with PHP 7.

Test the PHP version:

cd /opt/php-7.0.7/bin
./php --version

The output should be similar to this screenshot.

The PHP 7 final version on Debian 8.

Please note: The screenshot is from PHP 7.0.0, the tutorial gets updated continuously for new PHP 7 versions but we don't take new screenshots each time, so the PHP 7 version that you will see on your server is probably newer. The current version of this tutorial is for php-7.0.7.

4 Enable PHP 7 in ISPConfig

In ISPConfig 3, you can configure the new PHP version under System > Additional PHP Versions. On the Name tab, you just fill in a name for the PHP version (e.g. PHP 7.0.0) - this PHP version will be listed under this name in the website settings in ISPConfig:

Go to the FastCGI Settings tab and fill out the fields as follows:

Path to the PHP FastCGI binary: /opt/php-7.0.7/bin/php-cgi
Path to the php.ini directory: /opt/php-7.0.7/lib

Then g to the PHP-FPM Settings tab and fill out the fields as follows:

Path to the PHP-FPM init script: /etc/init.d/php-7.0.7-fpm
Path to the php.ini directory: /opt/php-7.0.7/lib
Path to the PHP-FPM pool directory: /opt/php-7.0.7/etc/php-fpm.d

Share this page:

84 Comment(s)

Add comment

Comments

From: Ricardo

Your forgot:

systemctl enable php-7.0.0-fpm.service

 

From: till

Thanks, added it.

From: cristian

i followed all instructions and now i get in wordpress sites

Error establishing a database connection

From: till

The default MySQL socket path from Debian and MySQL differs. You can fix that with:

/bin/ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

or use the updated configure statement from the tutorial and recompile php.

From: midian

And after this - u cant connect to your mariadb lol

From: till

You can connect to MariaDB by port, but not by socket. To connect by socket create a symlink for the socket:

/bin/ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

or alternatively use the updated configure string from the tutorial which sets the Debian socket path.

From: gscaglia

Where is the "string from the tutorial which sets the Debian socket path" ib this tutorial?

From: till

This comment is about a older version of this tutorial and does not applyto the cirrent version. The string is:

 

./configure --prefix=/opt/php-7.0.5 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm

 

as shown in the tutorial.

From: merkur

This guide also works for Ubuntu 15.10 with the following changes:

- instead of libjpeg62-turbo-dbg I had to install libjpeg-turbo8-dbg

- to create the system startup links, instead of using insserv I ran 'update-rc.d php-7.0.0-fpm defaults'

And one tiny thing: comments in /opt/php-7.0.0/etc/php-fpm.conf are with ; instead of #

From: Denis

 error 502 nginx

From: till

Check the error.log of the website.

From: Denis

unix:/var/lib/php5-fpm/web.sock failed (2: No such file or directory)

From: lnxgs

Hi,

you should disable "Use Socket For PHP-FPM" on options menu for your web domain. Swtiching from unix socket to tcp socket.

 

Regards,

L.

From: John

I can't install wordpress, joomla and drupal after i follow this and changed to PHP7 in ispconfig.  It seems permission I need to set. I couldn't figure it out.

From: till

Run:

/bin/ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

to create a symlink for the MySQL socket.

From: insta-follow

Thank you for this post!

From: g-lo

Everythink works

Thank You :)

From: Denis

Now i have error 500 joomla.But wordpress work good

From: till

You can find details on the source of the error in the error.log of the website. Not all CMS support PHP 7 yet or they may need additional PHP modules.

From: Igor Almeida

This is what I get:

Error 500 and on the log file:

[fastcgi:error] [pid 27711] (2)No such file or directory: [client ip:54113] FastCGI: failed to connect to server "/var/www/clients/client7/web11/cgi-bin/php5-fcgi-ip-80-domain": connect() failed

From: Aisfrond

Hi,

when enabling php-fpm apache looks for it on port 9010 and not on the port 8999 as mentioned above.

I'm still looking for a 'ispconfig' solution but in the meanwhile you can go to  /etc/apache2/sites-available and nano yourdomaincom.host and change the port wherever you can.

 

Alternatively you can change the php7 port to 9010 and it works greatly but then you can't use php5xx (php-fpm) unless you change again the port.

Hope this helps!

Aisfrond

From: till

You mix up port 8999 which is the instance for the www-data user with the insatnce created by ISPConfig for the website 9010. There is no need to edit any config files, just leave it as it is, you will see in phpmyadmin that the correct php version will show up in phpinfo after 60 seconds.

From: roman

nano /opt/php-7.0.0/lib/php.ini

set cgi.fix_pathinfo = 0

From: titi

Thanks for this! However I got a error 500 if I use php-FPM.

52] (104)Connection reset by peer: [client xxx:23480] FastCGI: comm with server "/var/www/clients/client0/web2/cgi-bin/php5-fcgi-xxxx" aborted: read failed

 

[Tue Dec 15 12:49:54.630691 2015] [fastcgi:error] [pid 4452] [client xxxx:23480] FastCGI: incomplete headers (0 bytes) received from server "/var/www/clients/client0/web2/cgi-bin/php5-fcgi-xxxx"

 

Why fast-cgi erros If I want to use php-FPM?

From: till

The apache module that does the connection to the php-fpm process is mod-fastcgi, that's why the error message contains the word fast-cgi. Most likely your php-fpm process is not started. If you need help with your setup, please us ethe forum.

From: titi

Ok so:

 

systemctl status php-7.0.0-fpm.service -l

I had:

 

ERROR: unable to bind listening socket for address '127.0.0.1:8999': Address already in use (98)

I changed to another port, like 8998. Restarted Apache. And it works now. thank!s

From: River Aras

Hello, i've done everything one by one but wordpress index page is not renderred. it loads the source of the php file instead of executing it.

<?php /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require( dirname( __FILE__ ) . '/wp-blog-header.php' );

From: sucette

Hi,

I tried to start php 7 and it's work on command line

etc/init.d/php-7.0.0-fpm startStarting php-fpm  done

./php --versionPHP 7.0.0 (cli) (built: Dec  6 2015 10:54:11) ( NTS )Copyright (c) 1997-2015 The PHP GroupZend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

 

But when I select Php7-fpm from website configuration, php is not interpreted

From: till

ensure that you have mod_fastcgi (not to be mixed up with mod_fcgi) is installed on the server and enabled in apache.

From: sucette

Ok now i've got cgi/fastCGI but not php-fpm 

[pid 23603] [client ip:51456] FastCGI: incomplete headers (0 bytes) received from server "/var/www/clients/client1/web7/cgi-bin/php5-fcgi-*-80-myndd.com"

Php info show :

Server API CGI/FastCGI

When i do 

 

sudo lsof -U | grep php

i've got 

php-fpm   22927      root    5u  unix 0x0000000000000000      0t0 35385577 P35385578

php-fpm   22927      root    7u  unix 0x0000000000000000      0t0 35385578 P35385577

 

php-cgi   24388      web7    0u  unix 0x0000000000000000      0t0 35390367 /var/lib/apache2/fcgid/sock/24254.0

mod_fcgi is installed and enabled.

From: till

You have to enable mod_fastcgi AND mod_fcgi as described in the ISPConfig perfect server tutorial. Currently, you have only mod_fcgi enabled and therefore only php-fcgi works but not php-fpm which requires the mof_fasrtcgi module.

From: inside83

I have both and still get:

[Mon Jan 04 04:33:25.244931 2016] [fcgid:warn] [pid 26708] [client xxx.xxx.xxx.xxx:5137] mod_fcgid: stderr: PHP Fatal error:...

From: Bart

Hello,

Did all parts of your tuto, good job.

php -v show me on php 5.6, with opCache ou zend cache on 7.0 (didn't remember which one exactly)

Is there any easy ways to check what was wrong or what isn't working?

From: Mohsen

Adding code mentioned in this tut and all I found on other tuts can't enable opcache!!! Php -v and opcache gui script say: opcache not enabled

From: till

Check the output of the phpinfo() command, if it shows opcache then it is enabled and your opcache detection script might have a failure or is not php7 compatible.

From: CreeWarrior

I had trouble with apt-get install libjpeg62-turbo-dbg i left it our and all the other packages installed. I noticed that 

The following extra packages will be installed:

  comerr-dev krb5-multidev libgcrypt11-dev libgnutls-dev libgnutlsxx27

  libgpg-error-dev libgssrpc4 libidn11-dev libjpeg-turbo8-dev libjpeg8-dev

  libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-7 libldap2-dev libp11-kit-dev

  libpam0g-dev librtmp-dev libssl-doc libtasn1-6-dev

 

I hope this will be alright to continue with libjpeg-turbo8-dev

From: Hans_Eimer

I use NGINX without ISPConfig! How to use php7/php-fpm on the whole System?

*.html files are accessible *.php files not... (i get a promt to download the php files)

cd /opt/php-7.0.0/bin => ./php --version: worksphp --version: not!

From: Ilko

Hi,

so I installed everything as shown here and it is working perfectly. The only issue is that I could not get memcache, memcacged and the other extensions to work. I was having issues with ioncube as well. The problem is that I am running ispconfig3 on rasberiP with Arm processors, after long research I found that I have to use ioncube loader specifically for Rasberry Pi in order to get it working, but I was not able to find memcache and other for Rasberri Pi. Do you know, if such occur ?

The error I am getting is: Unable to load shared library file - I was getting same error for ioncube, but using the correct loader for Rasberry Pi fixed it. Now I am getting the same for all the other extensions described in the tutorial.

From: lnxgs

Hi,

I followed the guide for PHP 7.0.1 and it works fine (I replaced every php-7.0.0 with php-7.0.1).

Tested with ispconfig 3 + Apache and ispconfig 3 + Nginx.

 

Regards,

L.

From: jnsc

If someone is interested, I also backported debian packages, but in order to not interfer with php5, you need to update to php5.6 before (I also backported this packages).

So this would only be for test environements.

From: Tom

Great tutorial, thanks a lot !

But actually I have this error /usr/bin/env: php: No such file or directory when trying to use composer. PHP 7 is correctly installed, indeed php -v shows what I expect.

PATH is not correctly configured, does not it; should symbolic link fix this ? (OS: debian 8)

From: Lars

I did this with php7.0.2 and it worked perfect!One question though, How do we update it? I am all new to not using apt-get.

From: till

The PHP is compiled manually, so you can not update this PHP version with apt-get. There are 2 options: Either you compile a new php version (e.g. 7.0.3) in a new folder and install it under a new name in ispconfig, then switch the sites to the new version, or you overwrite the old php version by compiling the new one in the same folder.

From: h4ni

Hello

I get this errors in error.log

 

2016/01/18 18:23:31 [error] 6011#0: *11 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined variable: data in /var/www/clients/client1/web1/web/includes/carte_flash.inc.php on line 15

PHP message: PHP Notice:  Undefined variable: town_links in /var/www/clients/client1/web1/web/includes/town_links.inc.php on line 13

PHP message: PHP Notice:  Undefined variable: ads_250 in /var/www/clients/client1/web1/web/includes/ads_250.php on line 2

PHP message: PHP Notice:  Undefined variable: search_widget in /var/www/clients/client1/web1/web/includes/right_content.inc.php on line 7

PHP message: PHP Notice:  Undefined variable: ret in /var/www/clients/client1/web1/web/includes/saved_towns.inc.php on line 7

PHP message: PHP Notice:  Undefined variable: footer_content in /var/www/clients/client1/web1/web/includes/footer_content.inc.php on line 4

From: till

These are warnings and not errors. They inform you about missing variable declarations in your php code.

From: Charles

I would like to enabel / install the intl libs, how do I go about it or do I have to reinstall ?

From: till

First you have to install libicu-dev:

 

apt-get install libicu-dev

 

then you can try to install it as module with pecl (I tried that yesterday at a client server but it did not work for me, did not had the time to investigate the issue in detail). I then just recompiled php with intl and that worked flawlessly.

From: ???

i found a error. correct locations:  cp /usr/local/src/php5-build/php-7.0.2/php.ini-production /opt/php-7.0.2/ect/php.ini     

From: till

The command in the tutorial that copys the file to lib is fine and not an error.

From: James

What is the fix on the socket for nginx/centos 7/mariadb?  Not sure why it is referencing php5 sock..? connect() to unix:/var/lib/php5-fpm/web5.sock failed (2: No such file or directory) while connecting to upstream, client: x.x.x.x, server: mydomain.com, request: "POST /wp-admin/setup-config.php?step=2 HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web5.sock:"

From: till

This tutorial is for Debian only, not CentOS. It is unlikely that this will work on CentOS without major modifications.

From: newtesla

Paths don't match, typo ;)"Then open /opt/php-7.0.2/etc/php-fpm.conf and ...

nano /opt/php-7.0.2/etc/php-fpm.d/www.conf

From: SpiGAndromeda

Hi,

i installed php7 from official source before. php5 was removed automatically. php-fpm7.0 is running. But i get a 500 internal server error when trying to access ispconfig. Could you please help me?

From: till

Replacing the system PHP 5.x with PHP 7 will cause the system to fail as ispconfig 3.0.5.x expects a PHP version between 5.2 - 5.6 for its interface and server process. Please undo the PHP replacement that and then install an additional PHP 7 version as described here to get PHP 7 support.

From: MatiPasio

Thank you for this tutorial, but I have problem.

I can't start php-7.0.3-fpm.service (systemctl enable php-7.0.3-fpm.service), because I get this error:

update-rc.d: error: php-7.0.3-fpm Default-Start contains no runlevels, aborting.

Can you help? Thanks.

From: oliiix

Worked flawlessly!! Thank you so much :D

From: oliiix

ok something is actually not working. it doesn't interprete php.. do i have to add some line to apache2 config or add a php mod to the apache mods folder? or do i have to have php5 installed too? or do i have to manually specify a mime type for it? i'm really not very into such stuff and actually only want it up and running so i can move to webapp building... i think setting up cassandra is also going to be a challenge for me... i have no clue. fcgi and fastcgi are both enabled as also stated in the log file. i really followed every step except the ispconfig section as this looks like it needs working php already.here the apache logfile content:

[email protected]:/etc/apache2# vim /var/log/apache2/error.log[Thu Mar 03 03:09:21.583385 2016] [:notice] [pid 1058:tid 140390004258688] FastCGI: process manager initialized (pid 1058)[Thu Mar 03 03:09:21.584409 2016] [mpm_event:notice] [pid 1055:tid 140390004258688] AH00489: Apache/2.4.10 (Debian) mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_fcgid/2.3.9 configured -- resuming normal operations[Thu Mar 03 03:09:21.584526 2016] [core:notice] [pid 1055:tid 140390004258688] AH00094: Command line: '/usr/sbin/apache2'

and the php-fpm log:

[email protected]:/etc/apache2# vim /opt/php-7.0.3/var/log/php-fpm.log[03-Mar-2016 03:25:11] NOTICE: fpm is running, pid 1440[03-Mar-2016 03:25:11] NOTICE: ready to handle connections~

From: till

The actual apache and nginx PHP setup is completely handled by ISPConfig (you can select php 7 in the website setings in fpm and fcgi mode) and yes, PHP5 is installed on an ISPConfig server as well (see perfect server tutorials) as this here is an additional PHP version that allows you to switch between php5 and php7 in the website in ISPConfig.

From: Hans

You should change the init script from

# Required-Start:    $all

# Required-Stop:     $all

to 

# Required-Start:    $remote_fs $network

# Required-Stop:     $remote_fs $network

 

Otherwise you will end up in cyclic dependent services when installing more than one version according to this tutorial.

From: DRL

I can not send mails from PHP, something is missing?

From: razor7

As mentioned by @merkur comments, it worked for me on my Ubuntu Server 14.04 x64. I Also changed the PHP version to 7.0.4 editing the related commands shown above, very easy!

From: razor7

Hi! In this comment I want to ask if I can still use my "suPHP_ConfigPath" directives on my .htaccess files on domains seto to PHP-FPM. If no, is there a .htaccess config to force PHP-FPM to load custom user php.ini files?

Thanks!

From: suther

 Works like a charm with php 7.0.4 - for wheeze, only skip the systemctl stuff.

Thanks a lot for this nice Step by Step HowTo.

From: instagib

On debian 7, getting this error:

 

28.03.2016-13:57 - WARNING - Apache did not restart after the configuration change for website mysite.com. Reverting the configuration. Saved non-working config as /etc/apache2/sites-available/mysite.com.vhost.err 28.03.2016-13:57 - WARNING - Reason for Apache restart failure: Failed to get D-Bus connection: No connection to service manager.

From: Diego

Up and running on Ubuntu 14.04 server.

Thanks for what a very usefull info!

From: Franbk

Has anyone hints to add xdebug to this installation?

From: bernie

Any solution regarding memcached yet? Many thanks

From: Lucjan

Hi,

On debian 8, getting Error 500 and on the log file:

[fastcgi:error] [pid 22406] (2)No such file or directory: [client xxx:26399] FastCGI: failed to connect to server "/var/www/clients/client1/web2/cgi-bin/php5-fcgi-*-80-mydomain.com": connect() failed[fastcgi:error] [pid 22406] [client xxx:26399] FastCGI: incomplete headers (0 bytes) received from server "/var/www/clients/client1/web2/cgi-bin/php5-fcgi-*-80-mydomain.com"

The previous answers did not help to solve the problem#systemctl status php-7.0.5-fpm.service -lshows:

php-7.0.5-fpm.service - The PHP 7 FastCGI Process Manager   Loaded: loaded (/lib/systemd/system/php-7.0.5-fpm.service; enabled)   Active: inactive (dead)Apr 24 01:19:07 isp systemd[1]: Unit php-7.0.5-fpm.service cannot be reloaded because it is inactive.

From: Chris

sudo apt-get install gcc make autoconf libc-dev pkg-configsudo apt-get install zlib1g-devsudo apt-get install libmemcached-devcd /usr/local/src/php5-buildgit clone https://github.com/php-memcached-dev/php-memcachedcd php-memcachedgit checkout php7/opt/php-7.0.6/bin/phpizePATH=/opt/php-7.0.6/bin:$PATH ./configure --disable-memcached-saslmakesudo make install

 

==> This one doesnt worksudo bash -c "echo extension=memcached.so > /opt/php-7.0.6/lib/conf.d/memcached.ini"

==> I could it only get it to work when i add it at example: /var/www/conf/web1/php.ini

sudo service php-7.0.6-fpm restart================================================================================sudo apt-get install gcc make autoconf libc-dev pkg-configsudo apt-get install zlib1g-devsudo apt-get install libmemcached-devcd /usr/local/src/php5-buildgit clone https://github.com/krakjoe/apcu

cd apcu

git checkout sevenmake cleanPATH=/opt/php-7.0.6/bin:$PATH ./configure make -j 4make installcd ..rm -rf ./apcu

==> and again, This one doesnt work# add extensionecho "extension=apcu.so" > /opt/php-7.0.6/lib/conf.d/ext-apcu.iniecho "apc.enable_cli = On" >> /opt/php-7.0.6/lib/conf.d/ext-apcu.ini

==> I could it only get it to work when i add it at example: /var/www/conf/web1/php.ini

i add

--with-config-file-scan-dir=/opt/php-7.0.6/lib/conf.d

when i compiled php-7.0.6

example:

./configure --prefix=/opt/php-7.0.6 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=www-data --with-fpm-group=www-data --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --with-config-file-scan-dir=/opt/php-7.0.6/lib/conf.d

From: Dallas

For Magento 2 you need install

apt-get install libicu-dev

and configure with --enable-intl

 

From: Stefano

How can i remove php7.0.2 before install the new version?

From: agentmoller001
From: Esteban Marin

Hi

I found a easier alternative that is also nicer to update: Use the PPA https://launchpad.net/~ondrej/+archive/ubuntu/php.

Here is how I successfully installed PHP7-FPM in parallel with PHP5.5-FPM on Ubuntu 14.04:

 

apt-get install software-properties-common

add-apt-repository ppa:ondrej/php

apt-get update

apt-get install php7.0-fpm

apt-get install php7.0-mysql

apt-get install php7.0-imap

apt-get install php7.0-mbstring php7.0-gd php7.0-zip

a2enmod proxy_fcgi

a2enconf php7.0-fpm

update-alternatives --set php /usr/bin/php5

Beware that enabling proxy_fcgi causes troubles with ISPConfig 3.0.5.4 when using PHP-FPM over Unix-Sockets, since the configuration is buggy in that case. See https://git.ispconfig.org/ispconfig/ispconfig3/merge_requests/343. You can also manually fix the file /usr/local/ispconfig/server/conf/vhost.conf.master

The last command changes the target of /usr/bin/php back to PHP5, the system default, which is recommended.

Apart from that, it is working well and enables to run PHP5 and PHP7 in FPM-Mode in parallel.

From: Amine

in case you got the error : configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.

Then you need to install the Imap headers of the c-client library : 

apt-get install libc-client2007e-dev

 

From: vaio1

Hi guys! Thanks for the tutorial!

I have a strange behaviour when I try to start the new 7.0.7 FPM

# /etc/init.d/php-7.0.7-fpm start

Starting php-fpm [13-Jun-2016 12:25:02] ERROR: failed to open error_log (/opt/php-7.0.5/var/log/php-fpm.log): No such file or directory (2)

[13-Jun-2016 12:25:02] ERROR: failed to post process the configuration

[13-Jun-2016 12:25:02] ERROR: FPM initialization failed

 failed

It read the old version 7.0.5 but I have deleted that obsolete directory. What have I to do? How to fix it?

thanks

From: emmaluc

on step :

Copy php.ini and php-fpm.conf to the correct locations:

I've this message : (in french)

cp: impossible de créer le fichier standard « /opt/php-7.0.7/lib/php.ini »: Aucun fichier ou dossier de ce type

On thi step, i've the same message :(

nano /opt/php-7.0.7/etc/php-fpm.conf

From: Andrea

You forgot this too: (To make php executable from everywhere)

cp /opt/php-7.0.7/php /bin/

From: till

I did not forgot this, the php binary should not be copied to /bin. When you do that, then you replace the system PHP with this additional PHP version, this is not intended and will break ISPConfig.

From: orasis

Hello any information on how to make geoip work with PHP 7 would be aprpeciated. Maybe in the next tutorial update it would be very useful. Thanks a lot, very good tutorial as always.

From: Jesse Norell

The php-7.0.9 source from github (or http://git.php.net/) does not include a `configure` script, to create it run `./buildconf --force` from within the php-7.0.9/ source directory.

From: Henri

Does this HOWTO work for Debian 7 as well?

Thanks

From: SpeedyB

I need the intl plugin so I had to install libicu-dev and add --enable-intl to the configure

From: SpeedyB

But the plugin is not available in PHP. Anyone any idea?

From: joost

in order to get CakePHP up and running, I need to install the intl extention. Where and how can I include this in this workflow?