使用PHP內(nèi)置web服務(wù)器第一次聽說過了,只聽過在windows中內(nèi)置了php運(yùn)行環(huán)境了,那么使用PHP內(nèi)置web服務(wù)器到底是一個(gè)什么東西呢,一起來看看。
PHP 5.4起就在CLI SAPI中內(nèi)置了web服務(wù)器,這給開發(fā)者帶來了方便。
只需在項(xiàng)目目錄下執(zhí)行
php -S localhost:8001
訪問鏈接,終端就會(huì)產(chǎn)生access log
- E:/php/test/web_server>php -S localhost:8001
- PHP 5.4.33 Development Server started at Sat Sep 26 12:10:01 2015
- Listening on http://localhost:8001
- Document root is E:/php/test/web_server
- Press Ctrl-C to quit.
- [Sat Sep 26 12:10:07 2015] 127.0.0.1:65349 [200]: /phpinfo.php
- [Sat Sep 26 12:10:07 2015] 127.0.0.1:65350 [200]: /phpinfo.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42
- [Sat Sep 26 12:10:07 2015] 127.0.0.1:65351 [200]: /phpinfo.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42
- [Sat Sep 26 12:10:07 2015] 127.0.0.1:65352 [404]: /favicon.ico - No such file or directory
可指定目錄和不同的php.ini配置
php -S localhost:8001 -t E:/php/test/web_server/ -c D:/software/amp/php-5.6.5-Win32-VC11-x64/php.ini
原來PHP 5.4起就在CLI SAPI內(nèi)置了服務(wù)器哦,小編使用的最高版本也是php5.3哦。
新聞熱點(diǎn)
疑難解答