带有PHP的Python SimpleHTTPServer [英] Python SimpleHTTPServer with PHP

查看:140
本文介绍了带有PHP的Python SimpleHTTPServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 python -m SimpleHTTPServer ,但是PHP文件不会执行,而是直接下载了.

I used python -m SimpleHTTPServer, but the PHP files don't execute instead they just been downloaded.

我在旧的

I heard about WPHP in an old post. But I don't know how to use it. How I can work with it ?

推荐答案

Python Web服务器将您的PHP文件发送给浏览器的原因很可能是因为它没有配置或无法处理PHP文件.参见 https://serverfault.com/questions/338394/how-to-run-php -with-simplehttpserver

The reason why the Python Webserver sends your PHP files to the brower is likely because it is not configured or able to handle PHP files. See https://serverfault.com/questions/338394/how-to-run-php-with-simplehttpserver

PHP 5.4具有内置网络服务器.您可以从命令行像这样调用它:

PHP 5.4 has a built-in webserver. You can call it from the command line like this:

php [options] -S <addr>:<port> [-t docroot]

示例

C:\Users\Gordon>php -S 127.0.0.1:80 -t .
PHP 5.4.0 Development Server started at Sun Sep 02 14:20:28 2012
Listening on 127.0.0.1:80
Document root is C:\Users\Gordon
Press Ctrl-C to quit.

请注意,如果省略-t,PHP将使用当前工作目录.

Note that if you omit -t PHP will use the current working directory.

这篇关于带有PHP的Python SimpleHTTPServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆