Total Pageviews

Tuesday 27 May 2014

PHPHTTPServer

It doesn't require any configuration so it can be used to quickly test PHP pages locally before uploading to web server.

Requirements

Usage

cd /path/to/www/rootPHPHTTPServer.py [port number]

Download

from http://code.google.com/p/jrfonseca/wiki/PHPHTTPServer

用法:
wget http://jrfonseca.googlecode.com/svn/trunk/phphttpserver/PHPHTTPServer.py
mv PHPHTTPServer.py /usr/local/bin/
chmod 755 /usr/local/bin/PHPHTTPServer.py
cd /path/to/www/root (cd到网站的根目录网站的根目录里须有index.php;当然有index.html也行;
但是这里http://briteming.blogspot.co.uk/2013/06/webserver-app-rwebserver.html所说的
Rwebserver只支持静态网站,不支持基于php的网站。而PHPHTTPServer则支持php网站和静态网站 )
PHPHTTPServer.py [port number] 
 
示例:
在此文http://briteming.blogspot.co.uk/2014/05/linux-vpsnodejs-techy.html中,
cd ~/techy-simple-blog/dist/
as3:~/techy-simple-blog/dist# nohup PHPHTTPServer.py 65342 > /dev/null &
访问http://as3.brite.biz:65342/即可看到网站效果。而用Rwebserver当然也可看到网站效果:
http://as3.brite.biz:42951/
用python的经典命令(只支持静态网站): nohup python -m SimpleHTTPServer 38610 > /dev/null &
也行。访问http://as3.brite.biz:38610/即可看到网站效果。