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.

I recently removed MAMP as I wanted to have more control over my machine and wanted to make use of PHP5.4 I installed using the script located here I cannot now not even get my default PHP that is built in to osx to work. I am running this script with a simple In a document in my ~/Sites directory. I am really at a loss as to why this will not work. I have php5 installed in my /usr/local directory via the link provided above and it seems like the main php is installed in /usr/bin

Any and all insight on how to debug this would be greatly appreciated.

share|improve this question

migrated from stackoverflow.com Jun 2 '12 at 5:16

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

add comment

1 Answer 1

Sounds like Apache is not properly configured to serve PHP documents. Check /etc/apache2/httpd.conf (or wherever you've stored your Apache config file, if not using the installation that ships with OS X) and make sure you're loading the mod_php module.

For example, my config file contains these lines:

LoadModule php5_module libexec/apache2/libphp5.so
<IfModule php5_module>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
        DirectoryIndex index.html index.php
    </IfModule>
</IfModule>

These may differ slightly based on your Apache installation. You said you "removed MAMP", but then it sounds like you're still using the Apache installation that ships with OS X.


You could try adding

AddHandler application/x-httpd-php .php

to a VirtualHost configuration block or to a .htaccess file and see if PHP works then. If so, Apache is configured properly to use PHP, you just need to associate the .php extension with the PHP interpreter.

If it doesn't work, check your error log (probably /var/log/system.log on OS X).

share|improve this answer
add comment

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.