I have enabled php according to PHP's instructions and uncommented,

#LoadModule php5_module libexec/httpd/libphp5.so

in /private/etc/apache2/httpd.conf. However the line,

#AddModule mod_php5.c

does not exist in that file, nor do any #AddModule lines. This may be the root of my problem but regardless I restarted apache with,

sudo apachectl restart

and attempted to open ~/Site/page.php

<title>My First PHP page </title>
<?php echo "<h1> Hello World! </h1>";?>

in multiple web browsers. Safari and Chromium just gave me the raw text of the file and Opera gave me

Hello World ";?>

Do I need to configure apache to add that module and how do I do that, or is there some other problem?

PS, I couldn't even open page.php with safari when it was in my home directory and other browsers tried to download it.

1 Answer 1


If the line doesn't exist commented-out, then just add it separately. i.e. put a line in httpd.conf that reads AddModule mod_php5.c.

  • Attempted that, doesn't work pastebin.com/5F2fnxKk
    – cheezsteak
    Commented May 21, 2013 at 13:14
  • Attempted that, doesn't work, I suspect mod_php5.c doesn't exist. So I used find /usr -name "mod_php5.c -print which returned null. cat /var/log/apache2/error_log for more details link
    – cheezsteak
    Commented May 21, 2013 at 13:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .