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

The final version of PHP 7.1 is available for download on Github and the PHP mirrors now. PHP 7.1 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.1 as a PHP-FPM and a FastCGI version on a Debian Jessie server. This PHP 7.1 build includes many compiled in extensions and Zend OPcache and Memcached as loadable modules.

 

1 Preliminary Note

I will install PHP 7.1 which has been released as final version a few days ago. 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.1, a single binary that supports FPM and FCGI mode can be build.

 

2 Compile PHP 7.1 with PHP-FPM and Fastcgi

Download and extract PHP 7.1 from Github:

mkdir -p /opt/php-7.1
mkdir /usr/local/src/php7-build
cd /usr/local/src/php7-build
wget http://de2.php.net/get/php-7.1.6.tar.bz2/from/this/mirror -O php-7.1.6.tar.bz2
tar jxf php-7.1.6.tar.bz2

cd php-7.1.6/

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

apt-get install build-essential nano autoconf

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.
root@server1:/usr/local/src/php5-build/php-7.0.7#

)

Configure and build PHP 7.1 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.1 --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/php7-build/php-7.1.6/php.ini-production /opt/php-7.1/lib/php.ini

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

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

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

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

Then open /opt/php-7.1/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.1/etc/php-fpm.d/www.conf

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

When you use multiple additional PHP versions, then ensure to use a free port, e.g. 8998, 8997 and so on for the next versions.

3 Create the init script and systemd unit file

Debian supports Systemd as well as the traditional init scripts. Most systems today use Systemd, in this case proceed with chapter 3.2, for systems with traditional init system, follow chapter 3.1 and then proceed with chapter 4. Do not install both, the systemd and init.d script, on the same system.

3.1 Create a init.d start script

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.1-fpm

#! /bin/sh
### BEGIN INIT INFO
# Provides:          php-7.1-fpm
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php-7.1-fpm
# Description:       starts the PHP FastCGI Process Manager daemon
### END INIT INFO
php_fpm_BIN=/opt/php-7.1/sbin/php-fpm
php_fpm_CONF=/opt/php-7.1/etc/php-fpm.conf
php_fpm_PID=/opt/php-7.1/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.1-fpm
insserv php-7.1-fpm

Finally start PHP-FPM:

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

The result should be:

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

3.2 Create  Systemd script for PHP 7.1

Now create the systemd unit file:

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

with the following content:

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

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

[Install]
WantedBy=multi-user.target

Enable the service and reload systemd:

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

Finally start PHP-FPM:

systemctl start php-7.1-fpm.service

4 Enable Zend OPcache

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

nano /opt/php-7.1/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.1 yet, so I will skip their installation for now. I will update the tutorial later when the pecl extensions are compatible with PHP 7.1.

Test the PHP version:

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

The output should be similar to this screenshot.

PHP 7.1.6

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

5 Enable Memcache (optional)

In this chapter, I will compile and enable the PHP Memcached extension.

The first step is to install the libmemcached-dev package from Debian.

apt-get install libmemcached-dev

Then create a diretory, download the PHP memcache extension from Github, unpack the archive and enter the directory that contains the unpacked files.

mkdir /usr/local/src/php7-build/php-memcache
cd /usr/local/src/php7-build/php-memcache
wget https://github.com/php-memcached-dev/php-memcached/archive/php7.zip
unzip php7.zip
cd php-memcached-php7

Prepare he sources by running the phpize command from PHP 7.1.

/opt/php-7.1/bin/phpize

Configure and build the PHP memcache extension.

./configure --with-php-config=/opt/php-7.1/bin/php-config
make
make install

To enable the Memcache extension, open /opt/php-7.1/lib/php.ini...

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

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

[...]
extension=memcached.so

2.1 Install xDebug extension (optional)

The xDebug module is a debugging extension for PHP. The installation is optional.

Install xDebug with these commands.

cd /opt/php-7.1/etc
pecl -C ./pear.conf update-channels
pecl -C ./pear.conf install xdebug

Then edit the php.ini file with an editor:

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

and add the following line at the end of the file:

zend_extension=/opt/php-7.1/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so

Finally restart the php-fpm daemon:

service php-7.1-fpm restart

7 Enable PHP 7.1 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.1) - this PHP version will be listed under this name in the website settings in ISPConfig:

Enter the name of the custom PHP version

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

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

PHP 7.1 FastCGI

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.1-fpm
Path to the php.ini directory: /opt/php-7.1/lib
Path to the PHP-FPM pool directory: /opt/php-7.1/etc/php-fpm.d

PHP 7.1 FPM settings

Share this page:

Suggested articles

54 Comment(s)

Add comment

Comments

From: Alaska at: 2016-12-13 20:29:34

Hello,First off, I love ISPConfig :)I followed the tuto for the perfect debian jessie server, I don't think this is a huge problem since the step was optional but thought I would mention, tried using this tuto to add php 7 and got this error when installing memcache:

 

root@host:/usr/local/src/php7-build/php-memcache/php-memcached-php7# /opt/php-7.1/bin/phpize

Configuring for:

PHP Api Version:         20160303

Zend Module Api No:      20160303

Zend Extension Api No:   320160303

root@host:/usr/local/src/php7-build/php-memcache/php-memcached-php7# ./configure --with-php-config=/opt/php-7.1/bin/php-config

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for a sed that does not truncate output... /bin/sed

checking for cc... cc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether cc accepts -g... yes

checking for cc option to accept ISO C89... none needed

checking how to run the C preprocessor... cc -E

checking for icc... no

checking for suncc... no

checking whether cc understands -c and -o together... yes

checking for system library directory... lib

checking if compiler supports -R... no

checking if compiler supports -Wl,-rpath,... yes

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

checking for PHP prefix... /opt/php-7.1

checking for PHP includes... -I/opt/php-7.1/include/php -I/opt/php-7.1/include/php/main -I/opt/php-7.1/include/php/TSRM -I/opt/php-7.1/include/php/Zend -I/opt/php-7.1/include/php/ext -I/opt/php-7.1/include/php/ext/date/lib

checking for PHP extension directory... /opt/php-7.1/lib/php/extensions/no-debug-non-zts-20160303

checking for PHP installed headers prefix... /opt/php-7.1/include/php

checking if debug is enabled... no

checking if zts is enabled... no

checking for re2c... re2c

checking for re2c version... 0.13.5 (ok)

checking for gawk... no

checking for nawk... nawk

checking if nawk is broken... no

checking whether to enable memcached support... yes, shared

checking for libmemcached... yes, shared

checking whether to enable memcached session handler support... yes

checking whether to enable memcached igbinary serializer support... no

checking whether to enable memcached json serializer support... no

checking whether to enable memcached msgpack serializer support... no

checking whether to enable memcached sasl support... yes

checking whether to enable memcached protocol support... no

checking whether to use system FastLZ bibrary... no

checking for ZLIB... yes, shared

checking for pkg-config... no

pkg-config not found

configure: error: Please reinstall the pkg-config distribution

root@host:/usr/local/src/php7-build/php-memcache/php-memcached-php7# make

make: *** No targets specified and no makefile found.  Stop.

 

From: till at: 2016-12-14 09:25:24

Maybe you missed installing the build-essential package?

run:

 

apt-get install build-essential

 

if this won't help, then install the missing package manually with:

 

apt-get install pkg-config

From: Lenny at: 2016-12-13 20:54:59

I can't pass through step 2 (Debian 8.6, sources.list - main contrib non-free)

E: Unable to locate package libc-client2007e-dev libxml2-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libfreetype6-dev libkrb5-dev libpq-devE: Unable to locate package libxml2-dev libxslt1-dev

Thanks for help

From: till at: 2016-12-14 09:29:01

The packages are available here on my Debian 8.6. The sources.list is:

 

deb http://ftp.us.debian.org/debian/ jessie main contrib non-freedeb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-freedeb-src http://security.debian.org/ jessie/updates main contrib non-free

From: rene at: 2016-12-14 09:30:02

Enable Memcache (optional)

gives me the follwing error on Debian 8.6

checking for pkg-config... no

pkg-config not found

configure: error: Please reinstall the pkg-config distribution

From: till at: 2016-12-14 09:31:02

See posts above.

From: thctlo at: 2016-12-14 13:57:30

Hai, to get the build dependecy fixed, and easy fix/try is. add the sid source line to the sources.list. deb-src http://ftp.us.debian.org/debian/ sid main contrib non-free

run apt-get update

run : apt-get build-dep php7.0 i dont think the depencies changed much here. Packages that didnt install due to version mismatch, install these manually. now compile php7.1

 

From: thctlo at: 2016-12-14 14:01:45

Till, i forgot to ask. If i setup on debian jessie and i create debian packages for php7(.1)( like the debdot versions php7.0 ) Can we still mix php5.6 with php7.x on debian jessie even with only debian packages installed? im asking this because only create debian packages and install with apt.

Source/compiling software is not allowed on my servers, so its a bit more difficult sometimes to setup.

 

From: Alfio Saitta at: 2016-12-16 09:33:30

Please, add the intl extension

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 libicu-dev

 ./configure --prefix=/opt/php-7.1 --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 --enable-intl

From: M1r at: 2016-12-28 20:41:03

for php_intl error:configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.

 

apt-get install libicu-dev

From: Johnymas at: 2016-12-16 14:11:39

Hi,

I got an error on ubuntu lts 16.04

E: Unable to locate package libjpeg62-turbo-dbg

Any suggestion?

From: till at: 2016-12-16 16:52:45

This tutorial is for Debian 8 only, not Ubuntu. The pacjage names on Ubuntu are different.

From: Johnymas at: 2016-12-16 17:44:46

Ok, thanks.

Till, is there any tutorial to install PHP 7.1 as PHP-FPM & FastCGI for ISPConfig 3.1 on ubuntu lts 16.04?

From: V-II at: 2016-12-22 20:40:04

so i've updated and installed 7.1 - appears to be going good..

biggest question...

what about updates?

another package i use is i-mscp.net 

they utilize a script to update the /opt/php7 - /opt/php5.6 - /opt/php/7.1 folders when a new version is released

 

When an updated 7.1 version is released do we need to remove the service so we can continue to use the port?

would be good to upate the existing links and use a master location that is updated when a version is updated. 

 

Client picks 7.0 / 7.1 / 5.6 - updates happen under them...

----

haven't seen how ISPCP would update vs just installing a new one and manually changing sites then deleting and backing out every change - eventually using up a crazy amount of listen ports!?! if not removed manually?

From: till at: 2016-12-23 09:34:26

Compile the new version into the same folder and restart php-fpm. Or you use folders for the sub versions like /opt/php/7.1.0, /opt/php/7.1.1 etc. and create a symlink /opt/php/7.1 that points to the recent version and then alter that symlink when you compiled a new version. The ports have not to be altered when you replace a version.

 

Btw. the above applies to the control panel ISPConfig and not ISPCP.

From: Sunny at: 2016-12-31 23:39:30

@til to Update for further Question (i could directly comment to that):

i tested your suggestion and create /opt/php/7.1/ with symlink to /opt/php/7.1.0 where i installed all like this tutorial says, thanks for that. it seems to work fine, but i got a mail from ispconfig with "WARNING - Action aborted, file is a symlink: /opt/php/7.1/lib/php.ini" so how to work with that and what does it mean at all, because the website works and shows working php 7.1 ?! thx

From: Ralf Behrendt at: 2016-12-28 11:55:37

Please add the save command after editing the files. Maybe some beginner is not sure if he should do it or not. Because in any other case you can copy & past, but how to save nano is not mentioned.

By the way on debian 8 adn ispconfig 3 the turorial works perfect for me.

From: Thomas at: 2016-12-28 22:02:11

If you go with the systemd script option, what is the path that you set in the "Path to the PHP-FPM init script" setting in ISPConfig?

From: till at: 2016-12-29 11:30:19

Just set it as if you would have added a init script, ispconfig detects that systemd is installed and uses a systemd unit with the name of the init script. S just do it as shown in the tutorial, the settings will work for init.d and systemd.

From: Thomas at: 2016-12-30 18:31:08

Thanks a lot for your response! The thing is that the path will be non-existent. Do I have to create the init.d script in /etc/init.d/php-7.1-fpm and just rely on the fact that ISPConfig will not use it if systemd is installed or just point to the non-existent location? The reason that I'm asking is that if I leave this line empty, the new version does not show up in my users' websites.

From: till at: 2016-12-31 13:00:04

Just do what the tutorial tells you to do in step 6 on your server. If you would have to do something different, then the tutorial would have told you. It does not matter if this path exists or not.

From: onastvar at: 2016-12-31 02:54:52

ISPConfig 3.1 does not SAVE the following entries. I have to click on CANCEL to get out of the screen.

Path to the PHP-FPM init script: /etc/init.d/php-7.1-fpmPath to the php.ini directory: /opt/php-7.1/libPath to the PHP-FPM pool directory: /opt/php-7.1/etc/php-fpm.d

From: till at: 2016-12-31 13:01:24

Just tested it here, the paths save fine. I guess you might have copied a whitespace or something like that and not just the path.

From: fbarcenas at: 2017-01-06 04:45:31

Any IONCUBE for this yet??

From: Andreas at: 2017-01-06 14:07:24

Hello,

i am very unexperiencend with linux an tried to follow these instructions. But after "make" and "make install" i can´t go one because the path /opt/php-7.1 is empty. What´s wrong?I use Debian 8 on bananapi

Thanks for help

Andreas

From: krishna at: 2017-01-10 15:20:24

same issue

From: DonMcCoy at: 2017-02-25 12:52:35

If you are on Debian 8 by now, install through the repo it's available now, don't go through the compiling hassle, when you compile it you can upgraded it in future or your can't add new components unless you recompile everything, but when you simply install it from a repo it's so flexible to upgrade, delete and add new componenets.

From: Maycon Brito at: 2017-01-09 00:52:51

Thank you! This was the first time that I instaled PHP from source with successfull. I put this page in my favorites.

I've installed  with debian:latest docker image and now I'm developing the Docker file from this tutorial.

From: Markus at: 2017-01-11 17:57:15

Hi, i installed the server with this tutorial https://www.howtoforge.com/tutorial/perfect-server-debian-8-jessie-apache-bind-dovecot-ispconfig-3/3/

and when I try to start /etc/init.d/php-7.1-fpm i get the following error:

 

root@webserver:/usr/local/src/php7-build/php-7.1.0# /etc/init.d/php-7.1-fpm start

Starting php-fpm [11-Jan-2017 18:53:49] ALERT: [pool www] the process manager is missing (static, dynamic or ondemand)

[11-Jan-2017 18:53:49] ERROR: failed to post process the configuration

[11-Jan-2017 18:53:49] ERROR: FPM initialization failed

 failed

Can you help me?

From: Christoforos Korifidis at: 2017-01-24 20:07:07

I follow the instruction but there are not any etc/fpm* files. Instead these files are under the directory sapi/. Can I use these files?

 

From: Max Devaine at: 2017-01-31 23:32:29

Configuration is very strange. You have some files in "/opt", some files in "/usr/share", you have configuration in "/opt/php-7.1/lib". This does not make sense. Why does not use dir options? For example :

./configure --prefix=/opt/php/7.1.1 \--bindir=/opt/php/7.1.1/bin \--sbindir=/opt/php/7.1.1/sbin \--libexecdir=/opt/php/7.1.1/lib \--datadir=/opt/php/7.1.1/share \--sysconfdir=/opt/php/7.1.1/etc \--sharedstatedir=/php/7.1.1/com \--localstatedir=/opt/php/7.1.1/var \--libdir=/opt/php/7.1.1/lib/x86_64-linux-gnu \--includedir=/opt/php/7.1.1/include \--infodir=/opt/php/7.1.1/share/info \--mandir=/opt/php/7.1.1/share/man \--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

From: abce at: 2017-02-03 19:07:16

Wow, Thanks.

I want a install php 5 near php7 in ispconfig on server decieded, How i can do it?

From: Jango at: 2017-02-10 09:46:13

if you have problem compile error: cc: Internal error: Killed (program cc1)

just add this in configure: --disable-fileinfo

From: Mat at: 2017-02-12 00:35:20

thanks for this great guide works perfect!

i have added it to my imscp ;-)

is for php7.1 also redis & apcu / apcu bc extensions available?

I cannot find the github to install it similar to memcache above

 

thx in advance 

From: Hirbod at: 2017-02-26 00:38:02

It is possible to install APCU.

cd /tmpgit clone https://github.com/krakjoe/apcucd apcu/opt/php-7.1/bin/phpize./configure --with-php-config=/opt/php-7.1/bin/php-configmakeexport TEST_PHP_ARGS='-n'make testmake installnano /opt/php-7.1/lib/php.ini (put at the end of file)Content:extension=apcu.soapc.enabled=1apc.shm_size=32Mapc.ttl=7200apc.enable_cli=1 

From: Porompompero at: 2017-03-16 12:43:08

Hi guys. I followed the tutorial. Fast-cgi works like a charm, but FPM doesn't work. I test with the classical "<?php phpinfo(); ?>", but my browser show the same code (no interpreting): "<?php phpinfo(); ?>"

Can you help me, please? Thanks.

From: helios at: 2017-03-20 11:58:37

hi, how fixed thie error please? thx

 

pkg-config est déjà la plus récente version disponible.

0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.

root@ns33XXX:/usr/local/src/php7-build/php-memcache/php-memcached-php7# /opt/php-7.1/bin/phpize

Configuring for:

PHP Api Version:         20160303

Zend Module Api No:      20160303

Zend Extension Api No:   320160303

Cannot find autoconf. Please check your autoconf installation and the

$PHP_AUTOCONF environment variable. Then, rerun this script.

 

root@ns33XXX:/usr/local/src/php7-build/php-memcache/php-memcached-php7#

From: Hbod at: 2017-03-22 00:14:42

PHP 7.1 has "WebP" support, please also add this into the Howto. apt-get install webp libwebp-devAnd add --with-webp-dir=/usrto the configure line!

From: SimonGilli at: 2017-03-27 10:11:58

Hi Till

Thanks for that great guide, everthing worked fine as expected!

But I really don't like to compile and install software by myself, I love debian packages ;-)

So I searched for an other way last week and I have found the PHP package maintainers site at https://deb.sury.org/ for Debian and Ubuntu packages. I followed the instructions at https://packages.sury.org/php/README.txt and installed versions 7.0 and 7.1 by apt-get (the default packages from debian were already installed before). Then I added the following PHP configs to IPSConfig and everything works fine so far:

PHP 5.6 (default packages by Debian):

PHP FastCGI Binary: php5-cgiphp.ini: /etc/php5/cgi/php.ini

PHP-FPM Init Script: php5-fpmphp.ini: /etc/php5/fpm/php.iniPHP-FPM Pool: /etc/php5/fpm/pool.d

PHP 7.0:

PHP FastCGI Binary: php-cgi7.0php.ini: /etc/php/7.0/cgi/php.ini

PHP-FPM Init Script: php-fpm7.0php.ini: /etc/php/7.0/fpm/php.iniPHP-FPM Pool: /etc/php/7.0/fpm/pool.d

PHP 7.1:

PHP FastCGI Binary: php-cgi7.1php.ini: /etc/php/7.1/cgi/php.ini

PHP-FPM Init Script: php-fpm7.1php.ini: /etc/php/7.1/fpm/php.iniPHP-FPM Pool: /etc/php/7.1/fpm/pool.d

I only tested Fast-CGI for the moment, it's possible that the FPM ports needs to be addaped to get FPM working. I will test that a.s.a.p.

I think the links in /etc/alternatives are pointing always to the highest version of PHP, so I had to add the 5.6 config because Default in ISPConfig points to 7.1 after that procedure and not longer to 5.6.

If you like this alternative procedure for installing PHP on Debian and Ubuntu, I will write an article for howtoforge after my tests are finished.

What do you think?

RegardsSimon

From: till at: 2017-03-27 10:15:36

Hi Simon,

thank you for posting the instructions. It would be great if you could write a tutorial about that for howtoforge.

Regards

Till

From: SimonGilli at: 2017-03-29 09:39:06

Hi Till,

I made some progress in my investigations, but one question on your tutorial is resting:

Why do you use an IP connection in /opt/php-7.1/etc/php-fpm.d/www.conf and not use the default socket connection? Is there a special reason for that? I think the socket connection is more lightweight than an IP connection and IP is only necessary for distributed installs where FPM runs on an other server.

RegardsSimon

From: Chris at: 2017-04-07 08:42:04

When I install this, it keeps throwing me the following error:

/etc/init.d/php-7.1-fpm startStarting php-fpm [07-Apr-2017 10:30:59] ERROR: No pool defined. at least one pool section must be specified in config file[07-Apr-2017 10:30:59] ERROR: failed to post process the configuration[07-Apr-2017 10:30:59] ERROR: FPM initialization failed failed

Any ideas?

From: cipito at: 2017-04-14 18:00:02

Does this work for CENTOS 7?

I need to add PHP 7 on my server.

I could not find any tutorial with Centos.

Thank you

From: LA at: 2017-04-19 12:15:56

Hi,

Thank you very much for this tutorial. I had followed every step. I have no error during installation and process.

But now when I chose PHP-FPM mode in Ispconfig with addionnal PHP version 7.1, I see the php source on the website. When I do the same thing chosing Fast-CGI mode with php 7.1 it run...

Do you have an idea ? 

thank you?

From: vikozo at: 2017-05-04 19:18:34

Hello

quiet at the beginnig i have a problem

# 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-devPaketlisten werden gelesen... FertigAbhängigkeitsbaum wird aufgebaut.Statusinformationen werden eingelesen.... Fertiglibc-client2007e ist schon die neueste Version.libc-client2007e wurde als manuell installiert festgelegt.Einige Pakete konnten nicht installiert werden. Das kann bedeuten, dassSie eine unmögliche Situation angefordert haben oder, wenn Sie dieUnstable-Distribution verwenden, dass einige erforderliche Pakete nochnicht erstellt wurden oder Incoming noch nicht verlassen haben.Die folgenden Informationen helfen Ihnen vielleicht, die Situation zu lösen:Die folgenden Pakete haben unerfüllte Abhängigkeiten: libc-client2007e-dev : Hängt ab von: comerr-dev soll aber nicht installiert werden                        Hängt ab von: krb5-multidev soll aber nicht installiert werden libkrb5-dev : Hängt ab von: krb5-multidev (= 1.12.1+dfsg-19+deb8u2) soll aber nicht installiert werden libpq-dev : Hängt ab von: krb5-multidev soll aber nicht installiert werden             Hängt ab von: comerr-dev soll aber nicht installiert werden libssl-dev : Hängt ab von: libssl1.0.0 (= 1.0.1t-1+deb8u6) aber 1.0.2k-1~bpo8+1 soll installiert werden              Empfiehlt: libssl-doc soll aber nicht installiert werdenE: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.

From: Dahero at: 2017-05-10 15:30:05

I'm wondering whats wrong with my install. Alternate PHP 7.1 shows up, I set it for the first site, and it goes 503. The error.log and the vhost conf file references to php5-fpm.

[Wed May 10 17:25:23.110960 2017] [proxy:error] [pid 24326] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/lib/php5-fpm/web1.sock (*) failed

[Wed May 10 17:25:23.137629 2017] [proxy_fcgi:error] [pid 24326] [client 10.211.55.2:58629] AH01079: failed to make connection to backend: httpd-UDS

I just upgraded ISPConfig3 to git-stable with no luck. Any idea other than hardcoding all the conf files?

From: Aloa at: 2017-05-12 11:56:18

Hi,I use this tutorial on Ubintu 12.04 with nginx. Everything work fantastic and correct like other Till's tutorials. Thank you!Now i need to install intl. I try:cd /opt/php-7.1/etcpecl -C ./pear.conf update-channelspecl -C ./pear.conf install intland get this error: ERROR: `/tmp/pear/temp/intl/configure --with-icu-dir=DEFAULT' failedi read some info and go to: apt-get install libicu-devNow i have new error:In file included from /tmp/pear/temp/intl/php_intl.h:34:0,                 from /tmp/pear/temp/intl/php_intl.c:25:/tmp/pear/temp/intl/intl_error.h:24:40: fatal error: ext/standard/php_smart_str.h: No such file or directory #include <ext/standard/php_smart_str.h>                                        ^compilation terminated.make: *** [php_intl.lo] Error 1ERROR: `make' failed Can anyone help me whit this error ?

From: oir91 at: 2017-07-03 22:17:47

I have the same problem installing pecl and I don't find information about this. Could anyone help with this error?

From: pix3l at: 2017-05-24 13:29:56

The installation worked on my system without any error. But when I create an info.php I get an ERROR 500 Internal Server error. But nothing is shown in the error/logfiles. There is also no php7-fpm error logfile in /var/log.

I also checked the rights and they seem to be correct as well (644 owned by webXY)

Any idea?

From: Rafael Santana at: 2017-06-07 00:16:42

Hi,

I got an error in instalation

root@server:/usr/local/src/php7-build/php-7.1.2# cp /usr/local/src/php7-build/php-7.1.2/php.ini-production /opt/php-7.1/lib/php.ini

cp: cannot create regular file '/opt/php-7.1/lib/php.ini': No such file or directory

root@server:/usr/local/src/php7-build/php-7.1.2# cp /opt/php-7.1/etc/php-fpm.conf.default /opt/php-7.1/etc/php-fpm.conf

cp: cannot stat '/opt/php-7.1/etc/php-fpm.conf.default': No such file or directory

root@server:/usr/local/src/php7-build/php-7.1.2# cp /opt/php-7.1/etc/php-fpm.d/www.conf.default /opt/php-7.1/etc/php-fpm.d/www.conf

cp: cannot stat '/opt/php-7.1/etc/php-fpm.d/www.conf.default': No such file or directory

 

From: Joel at: 2017-06-21 20:08:15

Error during install process:

pi@raspberrypi:~ $ sudo cp /opt/php-7.1/etc/php-fpm.conf.default /opt/php-7.1/etc/php-fpm.conf

cp: cannot stat ‘/opt/php-7.1/etc/php-fpm.conf.default’: No such file or directory

 

From: till at: 2017-07-05 10:42:07

Either the compilation with the make command failed or the make install failed on your system. Check make output for errors.

From: Yang Ke at: 2017-06-22 09:51:58

I have the same problem. Please help.

From: Roland Barkoczi at: 2017-07-02 19:49:14

Thank you for sharing this tutorial. My system built on Debian 7. Will this tutorial work on it?