简体   繁体   English

thttpd和php在CGI模式下

[英]thttpd and php in CGI mode

Is there a way to make PHP and thttpd work together in CGI mode? 有没有办法让PHP和thttpd在CGI模式下一起工作? There are some pieces of information here and there but our naive attempts failed so far as it seems like PHP doesn't understand the environment variables set by thttpd and therefore fails to find the script file. 这里和那里有一些信息,但我们天真的尝试失败,因为看起来PHP不理解thttpd设置的环境变量,因此无法找到脚本文件。

Building php as thttpd module is not desirable due to custom build configuration (it's an embedded device) - but possible as a last resort. 由于自定义构建配置(它是嵌入式设备),将php构建为thttpd模块是不可取的 - 但可以作为最后的手段。 However, I'd like to avoid that using CGI approach if possible. 但是,如果可能的话,我想避免使用CGI方法。

Wrap 包裹

/cgi-bin/php.cgi:
#!/bin/sh
export DOCUMENT_ROOT=/home/alex/thttpd/www
export SCRIPT_NAME=/cgi-bin/test.php
export SCRIPT_FILENAME=/home/alex/thttpd/www/cgi-bin/test.php
exec /usr/bin/php-cgi

or patch thttpd to export a suitable env for php-cgi 或修补thttpd导出适合php-cgi的env

This may not be the answer you're hoping for, but there seem to be no development in thttpd. 这可能不是你希望的答案,但是在thttpd中似乎没有发展。 I'd recommend mongoose. 我推荐猫鼬。 MIT-licence, good for embedded and easy php setup, 麻省理工学院许可证,适用于嵌入式和简单的PHP设置,

Runs on windows as well. 也在窗户上运行。

php setup: go WindowsUsage and scroll down. php setup:go WindowsUsage并向下滚动。

UPDATE: new link http://cesanta.com/docs/PhpWebsite.shtml 更新:新链接http://cesanta.com/docs/PhpWebsite.shtml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM