Apache2 refuses to process php files - "Snow Leopard" OSX 10.6.4

Posted by w-01 on Server Fault See other posts from Server Fault or by w-01
Published on 2010-11-12T20:03:16Z Indexed on 2012/06/24 3:18 UTC
Read the original article Hit count: 535

I have a macbook pro i5.
my understanding is that by default it should be able to serve php5.
i have uncommented the relevant line in /etc/apache2/httpd.conf

LoadModule php5_module        libexec/apache2/libphp5.so

I have restarted apache with

sudo apachectl -k restart

and when i try to access a file with a php extension, Apache prompts me to download the file. i.e. instead of processing the php and sending me html, it thinks i want to download the file....

when i look in apache error log i see this

[Fri Nov 12 10:16:14 2010] [notice] Apache/2.2.14 (Unix) PHP/5.3.2 mod_ssl/2.2.14 OpenSSL/0.9.8l DAV/2 mod_wsgi/3.2 Python/2.6.1 configured -- resuming normal operations

so it looks like php5 is loading properly.

I'd like to know either:
How do i fix this?
or
How do I reinstall apache2 so that it's like i just installed the os?

thanks in advance


update @Zayne - the end of my httpd.conf has

Include /private/etc/apache2/other/*.conf

and i have a file /etc/apache2/other/php.conf with the contents

<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>

@Zayne I've already copied php.ini.default to php.ini in the same folder. when i run

sudo apachectl configtest

i get

/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
Syntax OK

furthermore i decided to try

apachectl -M

which shows all loaded modules Most importantly in the list of loaded modules i got

Loaded Modules:
 php5_module (shared)

Since the module is being loaded, it seems like the issue has more to do with making apache use php engine to process the php files.... so something wrong with the ifmodule directive?

© Server Fault or respective owner

Related posts about osx-snow-leopard

Related posts about configuration