Last updated July 24, 2008. Created on July 15, 2007.
Edited by add1sun, scor. Log in to edit this page.

Mac OS X

How to set up a local web server on Mac OS X using MAMP. This 8 minute video shows you how to download, install and set it up. Written and recorded by Addison Berry of Lullabot.

Watch the MAMP video (.mp4 format, 21.2 MB)

Windows XP

How to set up a local web server on Windows XP using WAMP. This 9.5 minute video shows you how to download, install and set it up. Written and recorded by Addison Berry of Lullabot.

Watch the video (.mp4 format, 24.9 MB)

Ubuntu desktop

How to set up a local web server on Ubuntu. This 12 minute video shows you how to get the packages and set up clean URLs. It mostly uses a GUI to make it as easy as possible for folks who are new to Linux and may be hesitant to use the command line. Written and recorded by Addison Berry of Lullabot.

Watch the video (.mp4 format, 30.6 MB)

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

EliseVanLooij’s picture

Mac OS 10.6 (Snow Leopard) comes with Apache 2.2.x, PHP 5.2 and MySQL 5.x already installed, so you don't actually need to mess around with MacPorts or MAMP or whatever else. Even I was able to do it in an afternoon this time, instead of the usual two weeks. All you need to know is this:

* Apache webserver: turn on and off through checking or unchecking System Preferences >> Sharing >> Webserver
* MySQL server: turn on and off and check on status through System Preferences >> MySQL

The Apache server files are located at /private/etc/apache2 (to view in the Finder, use the Go menu >> Go to Folder and fill in /private). There you will find the httpd.conf which, if you have administrator privileges, you can edit with TextMate, BBEdit or in a Terminal editor like pico. If
LoadModule php5_module        libexec/apache2/libphp5.so
is commented out with a #, uncomment it.

I always change the DocumentRoot from "/Library/WebServer/Documents" to
DocumentRoot "/Users/myUserName/Sites"
in which case the Directory tag must be adjusted too:
<Directory "/Users/myUserName/Sites">

If you scroll down, you'll notice that the virtual hosts are specified in /private/etc/apache2/extra/httpd-vhosts.conf
If you want to use virtual hosts, open httpd-vhosts.conf and add something along these lines:

<VirtualHost *:80>
  DocumentRoot "/Users/myUserName/Sites"
  ServerName www.mysite.local
  ServerAlias mysite.local
 
  ErrorLog "/private/var/log/apache2/mySite.local-error_log"
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "/Users/myUserName/Sites/drupal-6.x-dev"
  ServerName www.mysite.drupal6.local
  ServerAlias drupal6.local *.drupal6.local

  ErrorLog "/private/var/log/apache2/mySite.drupal6.local-error_log"
</VirtualHost>

If you do this, you will also need to adjust /private/etc/hosts

# VIRTUAL HOST START

127.0.0.1 www.mysite.local
127.0.0.1 www.mysite.drupal6.local

# VIRTUAL HOST STOP

If you set up the virtual hosts in this way you do need to adjust the .htaccess file inside your drupal installation, like so:

  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  RewriteBase /

If you choose a different configuration, experiment with the different rewrite rules examples in the .htaccess file.

If needed, you'll find MySQL at /usr/local/mysql/bin/mysql.
To connect use:
User: root
Password:
Hostname: localhost
socket: /tmp/mysql.sock

If you find you need to use a php.ini (for instance for activating the zend debugger) you'll first need to copy /etc/php.ini.default to /etc/php.ini. Don't worry if you see various settings in php.ini point to /var/mysql/mysql.sock: on Snow Leopard this is a symlink to /tmp/mysql.sock so either will work.