2010-10-17

Configuring Mac Snow Leopard for Symfony development

If you want to develop symfony applications using the built in Apache web server in Mac OS X here are my notes. Keep in mind, this is not a production configuration but just the necessary steps to get a developer workstation up and running.
  1. Activate Web Sharing
    System Preferences -> Sharing -> Web Sharing
  2. Change your UserDir settings. In a terminal window, edit the file with your userdir configuration.
    vim /etc/apache2/users/username.conf
    Remove or comment the contents. Paste the following information:
    UserDir Sites/web


    <Directory "/Users/username/Sites/web">
        Options Indexes MultiViews
        AllowOverride All AuthConfig
        Order allow,deny
        Allow from all
    </Directory>

    Alias /~username/sf /Users/username/Sites/lib/vendor/symfony/data/web/sf

    <Directory "/Users/username/Sites/lib/vendor/symfony/data/web/sf">
      AllowOverride All
      Allow from All
    </Directory>
  3. Substitute the text username for you username.
  4. Enable php (and mysql if you want). See http://stackoverflow.com/questions/1293484/easiest-way-to-activate-php-and-mysql-on-mac-os-10-6-snow-leopard
  5. Now you can either install
    • the sandbox
    • the svn version,
    • the tar.gz version
    • or you can check out your existing project from source control.
  6. After you've installed symfony, edit the .htaccess file in the symfony web folder
    • Enable RewriteBase by uncommenting it
    • Change the RewriteBase directive  to RewriteBase /~username/
  7. Restart apache
    sudo apachectl restart

BTW: I wrote a more detailed post back in 2008. It hasn't been updated since then, but there might still be a few useful hints there: http://techinorg.blogspot.com/2008/07/ubuntu-post-install-customization.html

No comments:

Post a Comment