PHP not working on fresh OS X install
Posted: 19 January 2009
Twice recently I have formatted and started with a fresh install of leopard (10.5.6), and twice Apache has not loaded PHP correctly after enabling PHP in the config. It fails to add the .php file type, causing php files to download rather then display. This is due to execute permissions not being set on the /etc/apache2/other directory.
The solution
Here is what I needed to do to get PHP 5 working on a fresh install:
Using terminal:
open -a textmate /etc/apache2/httpd.conf
Locate and uncomment (remove the hash) from the PHP declaration (about line 115):
LoadModule php5_module libexec/apache2/libphp5.so
Save the httpd.conf, then back in terminal type:
sudo chmod 554 /etc/apache2/other/php5.conf
This will fix the PHP configuration file so it will load. You now need to restart the apache server:
sudo httpd -k restart
Everything should work as expected now.
Post a comment
Comment Guidelines
- You can subscribe to the comments on this entry via RSS.
- Have no more than 2 links, otherwise your comment will be flagged as spam.
- Links are automagically generated.
- <em>text</em> to make text italic.
- <strong>text</strong> to make text bold.
JavaScript needs to be enabled to comment.
Your comments (subscribe)
Ivan Vanderbyl 17 Apr 09 at 1:49pm
Remember Textmate has the mate command
$ mate /etc/apache2/httpd.conf
Neil 17 Apr 09 at 1:59pm
@Ivan True. I love that command. I thought I would show the alternate form of launching textmate in this post incase someone wasn't using the symbolic link.