Dec. 17, 2011

Sometimes you want to test a bit of PHP code on your local machine without installing a full LAMP stack. Mongoose is a web server that will let you do that.

Under Ubuntu I first downloaded and installed the mongoose source code, then I installed the package php-cgi and here is the script called phpserve that I use to launch Mongoose in the top level directory of my PHP project:

#!/bin/bash
mongoose -e error.log -r `pwd` -i index.php -p 8000 -C .php -I /usr/bin/php-cgi

After that you can browse to http://localhost:8000/ and you should see your site.

Enjoy!

Need software development advice? Book a call with me.