Upgrading PHP 5.X to PHP 7 on Ubuntu 14.04 / Apache

I upgraded my DigitalOcean droplet today to run PHP 7, after a few hiccups this was the process that worked best for me.

1. sudo apt-get install python-software-properties
2. sudo add-apt-repository ppa:ondrej/php
3. sudo apt-get update
4. sudo apt-get update && apt-get purge php5-fpm && apt-get --purge autoremove && apt-get install php7.0-fpm php7.0-mysql php7.0 php7.0-json php7.0-curl libapache2-mod-php7.0 php7.0-opcache php7.0-xml php7.0-gd php7.0-bz2
5. sudo service apache2 restart

If you are using NGINX, swap step 5 above to:

First udate your NGINX fastcgi_pass directive to: fastcgi_pass unix:/run/php/php7.0-fpm.sock;

then restart NGINX:

sudo service nginx restart

When you are all done type in php -v and it should say you are running PHP 7.

So far I haven’t run into any issues with WordPress or the various plugins I’m running.

There is a very noticeable speed increase across the board with WordPress as well!