Friday, January 22, 2016

Upgrade to PHP7.0-FPM from PHP5-FPM

Originally posted on https://bjornjohansen.no/upgrade-to-php7

Start out by loading the phpinfo.php file in the browser and make sure nginx and it are running corrrectly. You should see the full PHP installation information page with the current version number at the top of the page.

#Download the repository
add-apt-repository ppa:ondrej/php-7.0

#Always run an update
apt-get update

# This remove the existing php5 
apt-get remove php5-fpm --purge

#Remove any unused dependencies from php5
apt-get --purge autoremove

#Install PHP7
apt-get install php7.0-fpm php7.0-mysql

Edit /etc/nginx/sites-available/default:
replace: fastcgi_pass unix:/run/php5-fpm.sock;
with:     fastcgi_pass unix:/run/php7.0-fpm.sock;

On my server, the php7.0-fpm.sock file was located a directory deeper:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;

Now refresh the nginx service.
sudo service nginx restart

Refresh the phpinfo page in the browser. If you see an error, check the path to the fpm.sock file noted above. Otherwise, you should see the new PHP version information.

No comments:

Post a Comment