Wednesday, June 30, 2010

MacOSX Leopard Apache/PHP configuration

Apache HTTPD and PHP are installed automatically on MacBook Pros.

The Apache httpd.conf file is at: /private/etc/apache2/httpd.conf. There is a backup of the original file stored at /private/etc/apache2/original/httpd.conf if you screw it up and need a backup.

To turn on the webserver you have to go to System Preferences and click on the web sharing on box.

You have to add the line LoadModule php5_module libexec/apache2/ to the httpd.conf file. Most of the web instructions I found say you have to uncomment this line. I never found this line in any of the httpd.conf files.

The document root for your MacBook webserver is at: /Library/WebServer/Documents

add a phpinfo.php file with the contents

to make sure your php installation is correct. You should see a php generated info page describing the installation.

Copy /private/etc/php.ini.default to php.ini in /private/etc

Uncomment the php.ini lines for display_errors and display_startup_errors.
Change the Default Value to E_ALL from E_ALL ^ E_NOTIFY
Enable the development settings.

To setup .htaccess ...

No comments:

Post a Comment