Thttpd and php in CGI mode

Is there a way to get PHP and thttpd to work together in CGI mode? There is some pieces of information here, but our naive attempts failed because PHP does not understand the environment variables set by thttpd and therefore cannot find the script file.

Building php as a thttpd module is undesirable due to the configuration of the user assembly (this is an embedded device), but it is possible as a last resort. However, I would like to avoid this using the CGI approach, if possible.

+4
source share
2 answers

It may not be the answer you are hoping for, but there seems to be no development in thttpd. I would recommend the mongoose. MIT license, good for built-in and easy php setup,

It also works with windows.

Php setup: go to windowsusage and scroll down.

UPDATE: new link http://cesanta.com/docs/PhpWebsite.shtml

+2
source

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

+2
source

Source: https://habr.com/ru/post/1336483/


All Articles