PHP Web Server

user-pic
Vote 0 Votes

PHP 5.4.0 開始, PHP CLI 內建 Web Server

php -S 0.0.0.0:80
會以目前的目錄為 Document root

If Linux, 把這個 phpwebserver Script 放在 /etc/init.d
chkconfig phpwebserver on

修改一下 Script 前面的參數符合需求
PHP=/usr/local/bin/php
LOG=/var/log/phpwebserver.log
PORT=80
DOCUMENT_ROOT=/var/www/html

service phpwebserver start 即可啟動
index 檔搜尋的順序為 index.php index.html

拿來測試或小型網站使用應該很足夠

ref. PHP: Built-in web server

Leave a comment

About this Entry

This page contains a single entry by Pank published on July 17, 2012 4:50 PM.

Dropbox Remove Direct Link for new accounts was the previous entry in this blog.

DNS Abuse Attack ? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives