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.

 

Adding the Oracle extension (oci8) to MAMP PRO 3/OS X 10.9

I’ve never been successful in getting the OCI8 extension working on OS X (with or without MAMP) until now. I’ve been forced to use Vagrant (which is a usually a good thing) for anything requiring an Oracle connection).

 

Steps:

Make sure that the PHP version you are using in MAMP is in your path:
export MAMP_PATH=/Applications/MAMP/bin/php/php5.4.26/bin
export PATH=$MAMP_PATH:$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:~/composer-packages/vendor/bin

Download the basic and SDK packages.

Extract the files into a common folder (i.e.,/opt/oracle/instantclient). unzip *\.zip. They will all end up in a instantclient_11_2 folder, which I renamed to just instantclient. create two symbolic links:

ln -s libclntsh.dylib.11.1 libclntsh.dylib ln -s libocci.dylib.11.1 libocci.dylib

Download the source for the version of php that you are using in MAMP (I’m using 5.4.26).

Extract the PHP source file and move the created folder to the following location (based on PHP version): /Applications/MAMP/bin/php/php5.4.26/include/php. The contents of the extracted folder should be in the root of ../include/php.

Run sudo pecl install oci8 from anywhere.

For the oracle instant client path, use: instantclient,/opt/oracle/instantclient. If all goes well, the last line of the build process should say: You should add "extension=oci8.so" to php.ini In MAMP, go to File | Edit Template, choose your PHP version and add the above text where appropriate.

Open /Applications/MAMP/Library/bin/envvars and add the path to the instant client library: DYLD_LIBRARY_PATH="/opt/oracle/instantclient:/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"

Restart MAMP and go to the MAMP welcome page and open up phpinfo and see if there is an entry for OCI8. Done. Credit to http://caseymorford.com/2014/04/17/installing-oci8-with-mamp-pro/ for filling in a few missing pieces for me (downloading the source for the PHP version used in MAMP and edting the envvars file). For the other steps, the main difference for me is the preference of keeping the oracle library files in /opt/oracle like I would on an Ubuntu server.