Since Apple’s MacBook notebook uses OS/X that is built on top of Unix, it’s very like a server environment (while in Windows, we need to install something like Cygwin). So we can use this as a development environment. The problem is that it’s not so apparent to find where and how Apple organizes the things. For web development, it’s as follows:
Apache2
Apache2 is pre-installed.
- script: apachectl (in path)
 - config: /etc/apache2/*
 - htdocs: /Users/<user_id>/Sites
 - URL: http://localhost/~user_id/
 - log: /var/log/apache2/*
 
PHP
PHP 5 is also pre-installed, we need to enable it in Apache’s config file: uncomment the line with ‘php’:
LoadModule php5_module libexec/apache2/libphp5.so
add php type in “<IfModule mime_module>” block as follows:
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Restart Apache, we can pass the php test by creating a test.php as follows and put it in ‘Sites’ dir:
<?php phpinfo(); ?>
Perl & CGI
Now comes the good-old Perl CGI. According to Apache’s configuration, the CGI dir is “/Library/WebServer/CGI-Executables”, it’s mapped to URL “http://localhost/cgi-bin”. To make it easier, we can create a soft link in home dir:
ln -s /Library/WebServer/CGI-Executables Cgi
Now it can be tested with following script:
#!/usr/bin/perl -wT print "Content-Type: text/plain\n\n"; print "Hello CGI!\n";
mod_perl
Add following lines in proper places:
# load it LoadModule perl_module libexec/apache2/mod_perl.so # add a place to test mod_perl scripts ScriptAliasMatch ... (omitted, refer to the CGI one) <Directory "/var/www/cgi-bin/mod_perl"> SetHandler perl-script PerlHandler ModPerl::Registry Options +ExecCGI PerlOptions +ParseHeaders </Directory>
Now we are pretty much done. The only remaining thing that is good to have is MySQL…

This application is a tiny Windows utility, it is designed as a ‘tray application’, that is, it usually stays in the ‘tray’ of Windows task bar, unless you bring it out. The way how it keeps PC ‘awake’ is to send simulated key strokes periodically – to press F14 key every 4 minutes, to be precise. These are hardcoded since I don’t think it’s necessary to make these configurable.
