Running Drupal 8 and PHP 5.3.8+ on Mac OSX

Submitted by tomo on November 20, 2012 - 8:41am

I develop on my MacBook Pro and when building Drupal 6 sites, I had to run PHP 5.2 because there were many conflicts in Drupal 6 core and contributed modules which meant running on PHP 5.3 either threw up errors or didn't run properly. Since I run XAMPP for Mac OS X, I also run phpswitch which lets me switch from XAMPP using PHP 5.2 to PHP 5.3 and back.

Unfortunately, Drupal 8 not only requires PHP 5.3 but PHP 5.3.5 or higher. Drupal 7 ran fine on PHP 5.2.5 or higher with PHP 5.3 recommended.

1) XAMPP Mac OS X 1.7.3 comes with: Apache 2.2.14, MySQL 5.1.44, PHP 5.3.1.

Unfortunately, that's not a new enough version of PHP 5.3 for Drupal 8 to run.

bash-3.2$ pwd
/Applications/XAMPP/xamppfiles/bin
bash-3.2$ ls -la|grep php
lrwxr-xr-x    1 jay   admin         9 Feb 28  2010 php -> php-5.3.1
-rwxr-xr-x@   1 jay   staff   8774028 Apr 13  2009 php-5.2.9
-rwxr-xr-x@   1 root  admin  15620484 Feb 28  2010 php-5.3.1
lrwxr-xr-x    1 jay   admin        16 Feb 28  2010 php-config -> php-config-5.3.1
-rwxr-xr-x@   1 jay   staff      5838 Apr 13  2009 php-config-5.2.9
-rwxr-xr-x@   1 root  admin      5789 Feb 28  2010 php-config-5.3.1
lrwxr-xr-x    1 jay   admin        16 Feb 28  2010 phpextdist -> phpextdist-5.3.1
lrwxr-xr-x    1 jay   admin        12 Feb 28  2010 phpize -> phpize-5.3.1
-rwxr-xr-x@   1 jay   staff      4289 Apr 13  2009 phpize-5.2.9
-rwxr-xr-x@   1 root  admin      4607 Feb 28  2010 phpize-5.3.1
-rwxr-xr-x@   1 root  admin      5219 Feb 28  2010 phpswitch
-rwxr-xr-x@   1 root  admin    372104 Feb 28  2010 swftophp

2) MAMP. MAMP is LAMP for Mac instead of Linux. It's also a commercial product. And if you want to run PHP 5.3, you'll have to pay for the premium version of MAMP. But that is not necessary. So don't use MAMP for Drupal / PHP 5.3.

3) MNPP? Standing for Mac-Nginx-Percona-PHP, it is potentially both new enough and also offers better performance over Apache/MySQL.

From http://getmnpp.org/:

Core components:
Percona-Server-5.1.59
PHP-5.3.8
PHP-5.2.17
Nginx-1.0.9
phpMyAdmin-3.3.9.2
Python 2.6.7
uwsgi 0.9.8

Unfortunately, it didn't work for me.

bash-3.2$ /Applications/MNPP/Library/php53/bin/php
dyld: Library not loaded: /usr/lib/libedit.3.dylib
  Referenced from: /Applications/MNPP/Library/php53/bin/php
  Reason: image not found
Trace/BPT trap

4) Finally, I followed the instructions at http://php-osx.liip.ch/ to upgrade the system's PHP. This installs PHP 5.3.8 right now.

"This package installs the (usually) latest PHP 5.3.x/5.4.x on OS X 10.6 (aka Snow Leopard), OS X 10.7 (aka Lion) and OS X 10.8 (aka Mountain Lion) in /usr/local/php5."

bash-3.2$ php -v
 
PHP 5.3.8 (cli) (built: Dec  5 2011 21:24:09) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

Yay! Now Drupal 8 runs. This runs instead of XAMPP so I need to:

bash-3.2# /Applications/XAMPP/xamppfiles/xampp stopapache

before:

/usr/sbin/httpd -k start" or via /usr/sbin/apachectl

Read the rest of this article...
© 2010-2014 Saigonist.