When you've got Installer.app installed on your iPod Touch you'll notice that it allows you to install Apache and a number of scripting languages (PHP, Perl, Python, Ruby). That's all well and good but getting it to run in on that local Apache install is another thing. Just managed to get it to work with PHP 5.2.3 so just follow along if you're in the same situation:
1. Edit /etc/profile and update the line setting PATH to read as follows:
2. Edit /etc/httpd/httpd.conf and add the following to the end of the file:
ScriptAlias /php /opt/iphone/bin AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php-cgi"
2. Restart Apache by SSH'ing to the iPod Touch and running the following command:
Now put your PHP files into the webroot (/Library/WebServer/Documents/) and access them by pointing Safari to http://127.0.0.1/<path_to_your_file>.php
I'm yet to try it with Perl and Ruby but that should just be a matter of adding another ScriptAlias to httpd.conf of your local Apache install. Enjoy!