PHP-CGI has a security feature that causes the
interpreter to ignore command line parameters
when invoked from within a web server. Instead
of using the command line to find out what script
to execute, php-cgi uses the environment variable
SCRIPT_FILENAME.
Boa has a bug. It does not set the SCRIPT_FILENAME,
so you'll have to create a stub script that sets the
SCRIPT_FILENAME before invoking php-cgi, e.g.:
You can add the SCRIPT_FILENAME environment variable support
by just adding a line in the boa source file.
In src/cgi.c , after the line:
my_add_cgi_env(req, "SCRIPT_NAME", req->script_name);
add a line
my_add_cgi_env(req, "SCRIPT_FILENAME", req->pathname);
and PHP-CGI will work with no wrapper scripts.
Note: since PHP will run as CGI,
PHP scripts must have a header line like:
#!/usr/bin/php-cgi
and must have executable permission.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=1917107
Originator: NO
PHP-CGI has a security feature that causes the
interpreter to ignore command line parameters
when invoked from within a web server. Instead
of using the command line to find out what script
to execute, php-cgi uses the environment variable
SCRIPT_FILENAME.
Boa has a bug. It does not set the SCRIPT_FILENAME,
so you'll have to create a stub script that sets the
SCRIPT_FILENAME before invoking php-cgi, e.g.:
#!/bin/bash
export SCRIPT_FILENAME=/var/www/myscript.php
/usr/bin/php-cgi
I've tested this solution with PHP4, and it works.
Logged In: YES
user_id=1924154
Originator: NO
You can add the SCRIPT_FILENAME environment variable support
by just adding a line in the boa source file.
In src/cgi.c , after the line:
my_add_cgi_env(req, "SCRIPT_NAME", req->script_name);
add a line
my_add_cgi_env(req, "SCRIPT_FILENAME", req->pathname);
and PHP-CGI will work with no wrapper scripts.
Note: since PHP will run as CGI,
PHP scripts must have a header line like:
#!/usr/bin/php-cgi
and must have executable permission.