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

2010-10-01

The web2py ide

The web2py ide is Firefox. Or Chrome, or Opera, or Safari (or Internet Explorer).

Just create a good old frameset and you can have split view between models and controller, documentation and even a preview running in one browser tab. Running the browser in full screen and the built in code editors in "full screen" (which fills the whole assigned frame), this turned out to work really well.

Example frameset:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>web2py ide - 0.1 beta :)</title>
</head>
<FRAMESET ROWS="75%, *" COLS="*, 40%">
<FRAME SRC="http://127.0.0.1:8000/admin/default/peek/yourapp/models/db.py">
<FRAME SRC="http://127.0.0.1:8000/admin/default/design/yourapp">
<FRAME SRC="http://127.0.0.1:8000/yourapp/default/index">
<FRAME SRC="http://127.0.0.1:8000/yourapp/appadmin/index">
</FRAMESET>
</html>

Can you see some quick improvements? Post them in the comments!