Upgrade from PHP5 FPM to PHP7 FPM on Apache + Ubuntu 14.04 by PPA

For servers already running PHP5 using FPM

To upgrade to PHP7 FPM using Ondřej Surý’s PPA

1. Add Ondřej Surý’s PPA

add-apt-repository ppa:ondrej/php-7.0

2. Remove PHP5 and install PHP7

sudo apt-get update
apt-get purge php5*
apt-get install php7.0-fpm

3. Configure PHP FPM with Apache

touch /usr/lib/cgi-bin/php.fcgi
chown -R www-data:www-data /usr/lib/cgi-bin

Create Apache PHP FPM Config

vim /etc/apache2/conf-available/php-fpm.conf

=====
<IfModule mod_fastcgi.c>
   AddHandler php.fcgi .php
   Action php.fcgi /php.fcgi
   Alias /php.fcgi /usr/lib/cgi-bin/php.fcgi
   FastCgiExternalServer /usr/lib/cgi-bin/php.fcgi -socket /run/php/php7.0-fpm.sock -pass-header Authorization -idle-timeout 3600
   <Directory /usr/lib/cgi-bin>
       Require all granted
   </Directory>
</IfModule>
a2enconf php-fpm
service apache2 restart

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.