Mac OS X Snow Leopard: Set up Apache, MySQL, PHP (MAMP)

A small guide for Mac OS X Snow Leopard to set up the built in Apache webserver, install and configure a MySQL database management system and set up the also built in PHP scripting language, so that you run your own (MAMP-) webserver for local webdevelopment.

Many people use predefined packages to run a local webserver, but Apples operating system brings nearly all of the required stuff to do this out of the box. The rest is installing MySQL (or a other DBMS of your choice) and a little configuring here and there.

After you completed all steps you considered necessary, start/restart your Apache Webserver aka Web Sharing via "System Preferences > Sharing > Web Sharing" or by typing sudo apachectl start/sudo apachectl restart into Terminal App.

You should now be able to access PHP-Scripts, PHP-Apps, etc. that you put into the Sites-folder inside your user-folder with your browser via http://your-computers-name/~your-(short)-username/.

Apache

Tell Apache to load the PHP-Module

  1. Open /etc/apache2/httpd.conf
  2. Uncomment the line LoadModule php5_module …

Activate the mod_rewrite-module

  1. Open /etc/apache2/httpd.conf
  2. In the <Directory>-section, change AllowOverride None to AllowOverride All
  3. Open /etc/apache2/users/your_username.conf
  4. In the <Directory>-section, add FollowSymLinks to the Options-line and make shure AllowOverride All is activated

MySQL

  1. Download the latest MySQL version
  2. Install the MySQL-.pgk
  3. Install the pref-pane
  4. Start MySQL via "System Preferences > MySQL > Start MySQL Server" or by typing sudo /usr/local/mysql/support-files/mysql.server start into the terminal

PHP

Fix mysql.sock location

  1. Open /private/etc/php.ini.default
  2. Replace all three occurences of /var/mysql/mysql.sock with /tmp/mysql.sock
  3. Save the file as php.ini

Fix date.timezone-warning

  1. Open /private/etc/php.ini
  2. Uncomment the line date.timezone =
  3. Add your timezone, for example date.timezone = "Europe/Berlin"

Activate PHP short tags

  1. Open /private/etc/php.ini
  2. Change the line short_open_tag = Off to short_open_tag = On

 

References

 

1 Comment(s)

Liza1966

Jul 24
at 2:23

Das ist wirklich mein Problem gelöst, danke!

Add your comment

Please keep it polite and on topic. Your email address will not be published.

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)