Following my post on Snow Leopard Gotchas, I discovered another problem you might run into. SL comes with currently the latest version of PHP 5.3.0. However, not all PHP projects will play nice on v5.3.0. What you could do is:
1. build and configure an older version of PHP from source – e.g. 5.2.11
2. Install Entropy PHP (note: this will modify your SL Apache config files).
3. Or just be lazy and install MAMP (Macintosh, Apache, MySQL, PHP) in a few seconds.
I chose the last option for 5 reasons:
1. I’m lazy
2. Comes with PHP 4.4.9 & 5.2.10
3. It installs a complete package in one directory
4. It doesn’t mess with my existing apache config files
5. it’s easy to uninstall.
This is particularly useful for content editors who have phobia of terminal windows (I don’t blame them). Hopefully some developers will find this useful too.
After you’ve downloaded and installed MAMP, you’ll notice that the installer created /Applications/MAMP directory. Launch your MAMP Control Center, start your services and away you go.
By default, your Apache web server will run on port 8888. You can change this to port 80 in Preferences, but if you do that you will have to make sure that your OS X Web Sharing is stopped. You can stop it in System Preferences=>Sharing=>Web Sharing.
Normally your Apache virtual would be here:
/etc/apache2/users/*.conf or /etc/apache2/extra/httpd-vhosts.conf
MAMP keeps virtual hosts separately in:
If you ever want to uninstall MAMP, all you need to do is Trash /Applications/MAMP directory and you’re done. It’s simple and clean.
[quote type=”pull” style=”2″ align=”center” width=”60%”] For more info see MAMP documentation. [/quote]
Problems you may have with Entropy PHP
[infobox type=”warning” align=”center” width=”75%”]NOTE: always backup any .conf file you are going to modify or remove.[/infobox]
Entropy PHP will add a new config file in /etc/apache2/other and possibly modify your httpd.conf. If you’re having problems running PHP, there could be various symptoms. The one I was seeing in apache error logs was this one:
child pid 7563 exit signal Segmentation fault (11)
I’m not sure what this means exactly, but it happens when your Entropy config file:
tries to load the problematic php module:
LoadModule php5_module /usr/local/php5/libphp5.so
To solve this, I would recommend removing all Entropy stuff and go back to your native PHP 5.3.0. You could try removing, or backing up +entropy-php.conf and uncomment the following line in your httpd.conf
LoadModule php5_module libexec/apache2/libphp5.so
Also check that this file exists:
and that it contains
<IfModule php5_module> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.html index.php </IfModule>