Last updated March 10, 2012. Created by greggmarshall on April 22, 2010.
Edited by screenack, Haza, cloudmaker, red77. Log in to edit this page.

Optional instructions on setting up a local MAMP (Mac Apache MySQL PHP) server.

For an external server, follow these steps:

  1. Install Drupal 7.0 as /Users/xxx/Sites/drupal, user xxx is in the "_www" group and make the entire installation group-writable. Create a soft link from
    /Library/WebServer/Documents/xxx to /Users/xxx/Sites.
  2. Re-writing seems to be enabled by default in Apache2 on Leopard. Enable PHP5 and virtual hosts in Apache2 by uncommenting these lines in /etc/apache2/httpd.conf:
    #Dynamic Shared Object (DSO) Support
    #LoadModule libexec/apache2/libphp5.so
    #Virtual hosts (This is just a marker for what follows so you should leave the #.)
    #Include /private/etc/apache2/extra/httpd-vhosts.conf
  3. Add a virtual host stanza to the /private/etc/apache2/extra/httpd-vhosts.conf file that has at least this in it:
    <VirtualHost *:80>
    DocumentRoot /Library/WebServer/Documents
    ServerName localhost
    <Directory /Library/WebServer/Documents>
    Options FollowSymLinks Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>
  4. Add a variant of the RewriteBase /drupal line in the stock /Users/xxx/Sites/drupal/.htaccess file:
    IfModule mod_rewrite.
    RewriteEngine on
    # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
    # VirtualDocumentRoot and the rewrite rules are not working properly.
    # For example if your site is at <a href="http://example.com/drupal" title="http://example.com/drupal" rel="nofollow">http://example.com/drupal</a> uncomment and
    # modify the following line:
    # RewriteBase /drupal
    RewriteBase /xxx/drupal
    # Rewrite URLs of the form & to the form index.php?q=x&.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico<br /> RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    IfModule
  5. Make a copy of the
    /Users/xxx/Sites/drupal/sites/default
    directory tree as
    /Users/xxx/Sites/drupal/sites/localhost.
    and make sure this directory is writable by the _www group.
  6. Manually create the database in MySQL. Make a copy of
    /Users/xxx/Sites/drupal/sites/localhost/default.settings.php file as
    /Users/xxx/Sites/drupal/sites/settings.php and make this file writable by the _www group. Configure the database in /Users/xxx/Sites/drupal/sites/settings.php

      $databases['default']['default'] = array(
        'driver' => 'mysql',
        'database' => 'databasename',
        'username' => 'username',
        'password' => 'password',
        'host' => 'localhost',
        'prefix' => 'main_',
        'collation' => 'utf8_general_ci',
      );
  7. Read this first:
    Enable the GD Library on Snow Leopard
    Unlike previous version of OS X, Snow Leopard comes with a version of PHP that supports the GD library without having to recompile PHP. To enable the GD library in PHP, edit the /etc/php.ini file and remove the comment (the semi-colon) from this line:

    ;extension=php_gd2.dll

    Once you remove the semi-colon, restart the Apache server and the GD libraries will then be available in PHP.

    Rebuild PHP5 to include the GD tools according to the instructions here.

  8. After modifying the file permissions in the next step, go to http://localhost/xxx/drupal/install.php. The pages came up as shown on the Run the install script.

About this page

Drupal version
Drupal 7.x
Audience
Site administrators
Keywords
apache, installation instructions, MAMP, process, user, virtual hosts
Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.