Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Okay so I have a confession first off … I've been messing … and I've broken the way that my local machine is behaving.

With that out of the way, here is some basics.

  • I'm running OS X 10.6.7
  • I Removed the default Apache install and replaced it with the lastest version from Apache.
  • I can now serve HTML from /usr/local/apache2/htdocs/ through 'localhost' which is okay.
  • I can't serve any PHP (it just shows up as plain text).

I'm sure that to get a solution I'm going to have to post some config files here but I'm not sure what you'd need; what'll be?

Here is my httpd.conf

share|improve this question

migrated from stackoverflow.com May 24 '11 at 12:14

This question came from our site for professional and enthusiast programmers.

    
Have you installed PHP or just Apache? If just Apache, you now need to install PHP. –  Anonymous May 23 '11 at 22:19
    
Not the exact answer to your particular setup but you may want to try MAMP if you just "want to get something up and running" mamp.info/en/index.html –  Anonymous May 23 '11 at 22:20
    
Hi. This question belongs on another of the sites in the Stack Exchange eco-system due to its contents. Please check the FAQ for more information about what are appropriate question on Stack Overflow, and also take a look at the similar FAQ on the site I am migrating your question to. Thanks. –  Lasse V. Karlsen May 24 '11 at 12:14
    
PHP is installed with OS X isn't it? I've not done an additional install. –  Shaun May 25 '11 at 13:54

3 Answers 3

Did you enable PHP within the Apache configuration file?

Default location:

/private/etc/apache2/httpd.conf

Remove the # before the following line:

LoadModule php5_module        libexec/apache2/libphp5.so

Finally restart Apache.

share|improve this answer
    
There is no LoadModule lines in my httpd.conf - see my httpd.conf –  Shaun May 25 '11 at 13:44

Normally on OS X to enable PHP you have to edit /etc/apache2/httpd.conf and make sure the line that starts with this is uncommented (i.e. doesn't start with "#"):

LoadModule php5_module

This may help you. Or not. Not enough info to say.

share|improve this answer
    
There is no LoadModule lines in my httpd.conf - see my httpd.conf –  Shaun May 25 '11 at 13:52

If PHP has been installed, have you configured Apache correctly to hand .php file to the PHP CGI executable or Apache module? To do that, you'll need an AddHandler or AddType directive somewhere in your Apache configuration.

See steps 7 and 8 on this page (http://www.php.net/manual/en/install.unix.apache2.php) for the specific directives you'll need.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.