Quick and Dirty PHP 7.0 set up on Ubuntu 14.04 with APCu

This is how I got PHP 7 and APCu running on one of the entry-level Digital Ocean droplets:

PHP 7

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php-7.0
apt-get update && apt-get purge php5-fpm && apt-get --purge autoremove && apt-get install php7.0-fpm php7.0-mysql php7.0-gd php7.0-dev

If you need additional php7.0 packages, check the list:

sudo apt-cache search php7

In my enabled nginx site configs (I'm sure there's a place to put this globally, but I only had a couple of sites, so I didn't bother researching that for now):

Replace:

fastcgi_pass unix:/var/run/php5-fpm.sock; 

With:

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

APCu

git clone https://github.com/krakjoe/apcu

Follow the instructions for building APCu in the INSTALL file

In addition to the updates to php.ini described in the INSTALL file, update the 'extensions_dir' directive:

extension_dir = "/usr/lib/php/20151012/"

Do the same for both the FPM and CLI versions of php.ini

Restart PHP-FPM and Nginx:

sudo service php7.0-fpm restart
sudo service nginx restart

That did it for me. With APCu installed, I can continue to use APC as the driver for session and cache in my Laravel 5 apps when Memcache, Redis, etc. are overkill.

 

comments powered by Disqus