Tuesday, November 12, 2002


PHP on OS X redux

Dan Wolfe wrote with a suggestion to move the two AddType directives to a different spot in the apache configuration file such that PHP will be enabled for the user accounts under OS X.

My original instructions only enable PHP for the document root, not for individual user accounts.

By following Dan's instructions, PHP is now enabled for all accounts and I can check off one more item [manipulating the contents of /Library/WebServer/Documents/] that requires administrative access.

Simply move the two AddType lines from the original instructions....

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

... from the <Directory "/Library/WebServer/Documents"> block to the Document types block headed by the block. I chose to add them at the end:

<IfModule mod_mime.c>
... many lines removed for brevity ...
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>

Once done, restart the apache server (web sharing via system preferences), drop the test script into the Sites directory within your home directory, and load the URL http://localhost/~<<user>>/foo.php to test.
11:30:17 PM