Installing Sahana on Mac OS X

by Antonio Alcorn (alcorn at

Sahana is designed to run on any system running PHP and MySQL. On Mac OS X, it requires just a few tweaks to get up and running.

1. Download the "source" package for the desired release @

2. Unpack the tarball. You should get a folder called sahana. Move this folder into the "Sites" directory in your home folder. (See note below)

3. In Terminal, set the permissions for the conf/ and www/tmp/ directories under sahana to be writable by the webserver. In Mac OS X, the webserver runs as 'nobody', so we'll set them to world-writable. For example:

powerbook:~ antonio$ chmod a+w Sites/sahana/conf/
powerbook:~ antonio$ chmod a+w Sites/sahana/www/tmp/

4. If you have Mac OS X 10.4 (Tiger) or later, it shipped with php4, but the installation is slightly quirky. Previous versions of the OS didn't ship with PHP at all. In either case you'll want to go to Marc Liyanage's site at and download and install the "PHP 5 on Mac OS X 10.4, PPC and Intel" package.

5. If you want to use a local mysql database, you'll need to install that as well. Go to and scroll down to Mac OS X downloads. Download the "Standard" disk image for your platform. Run the installer, and while you're at it double-click the handy prefPane supplied on the disk image to install it. The initial default mysql user is called root, with a blank password. mysqladmin will be located at /usr/local/mysql/bin/mysqladmin, so, for example, to create your database for sahana the command might look like:

/usr/local/mysql/bin/mysqladmin -u root create sahana_db

You might also want to install a copy of phpMyAdmin.

6. Sahana makes extensive use of PHP's optional "short tags" feature (the <? ...code... ?> or <?=something to print?> syntax). Short tags are disabled in the default installation of php5. To fix this, edit /usr/local/php5/lib/php.ini and look for this line:

short_open_tag = Off

...and change it to:

short_open_tag = On

then save the changes.

7. Go to System Preferences > Sharing > Services and turn on Personal Web Sharing. If you already had it on, turn it off and then on again. This restarts the apache process and forces it to reload httpd.conf and php.ini.

8. Point your browser to http://localhost/~yourusername/sahana/www/ and go through the web installer. You should be ready to go!


By default, the apache installation included with Mac OS X maps http://localhost/~yourusername/ to /Users/yourusername/Sites/, and http://localhost/ to /Library/WebServer/Documents/. If you want to install sahana with a "nice" namespace, you can edit /etc/httpd/httpd.conf and find the following line:

DocumentRoot "/Library/WebServer/Documents/"

You could change it to something like

DocumentRoot "/Users/yourusername/Sites/sahana/www/"

And restart apache. Then, if you put the sahana folder in your Sites folder, browsing to http://localhost/ would bring you to your Sahana installation.