Invoking the PHP interpreter form a suexec CGI PHP program.
| From: | Andrey Petrov | Date: | Tue, 14 Oct 2003 13:23:54 +0000 |
| Subject: | Invoking the PHP interpreter form a suexec CGI PHP program. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-166073@lists.php.net to get a copy of this message | ||
Hi
I have configured successfully a PHP application to run as a CGI application
with apache/suexec.
The following program runs as expected:
#!/usr/bin/php -q
<?php
print ("Content-type: text/html\n\n");
print (
id); //outputs the correct uid/gid as sepcified with apache's
User and Group directives
?>
this program can be run from the command line, as a regular CGI script, or
as a suexec CGI script.
If we modify it like this:
#!/usr/bin/php -q
<?php
print ("Content-type: text/html\n\n");
print (/usr/bin/php -v); //does not work under suexec
?>
it works as a regular cgi program, or when run directly from the command
line or when run thru mod_php4. But it does NOT work as a suexec CGI
script.
It seems that you cannot launch another PHP interpreter process from within
a suexec CGI PHP script.
Any suggestions?
/usr/bin/httpd -v
Apache/1.3.27 (Unix) (Red-Hat/Linux)
/usr/bin/php -v
PHP 4.3.3 (cgi) (built: Sep 17 2003 15:57:16)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
p.s.
the same program written in perl:
#!/usr/bin/perl -w
print ("Content-type: text/html\n\n");
print (/usr/bin/php -v);
works perfectly as expected without any problems under suexec.