I was looking for a lightweight, simple HTTP server to serve up static files form the current directory, for testing my ongoing web-development projects. It was pretty trivial to write one in Python, using SimpleHTTPServer class.
However when I had to test some PHP code, things got a little complicated. It was still quite easy to rewrite that small Python server with CGIHTTPServer to run a simple phpinfo() script, but that was far away to produce a complete CGI environment for running more complicated PHP scripts (with file uploads, for example).
I spent a whole evening looking for something similar that already implements it correctly. My big surprise, Ubuntu Gutsy is full of packaged simple web servers, but none of them supports PHP scripts with php-cgi out of the box.
The only one I found exciting is shttpd. It's available for Windows and Unix-like OSes. Compiling is trivial. Run it with:
shttpd -d /var/www -p 8080 -D 1 -c php -C /usr/lib/cgi-bin/php5 -l /dev/stdout -e /dev/stderr
Options:
- -d /var/www
- web root directory
- -p 8080
- listen on port 8080
- -D 1
- enable directory listing
- -c php
- CGI extensions
- -C /usr/lib/cgi-bin/php5
- CGI interpreter (php-cgi this time)
- -l /dev/stdout
- access log to stdout
- -e /dev/stderr
- error log to stderr
2 comments:
Hi, could you try it under windows xp? I faild to start shttpd use those parameter.
Post a Comment