I have from time to time using the CGI shell for PHP. I know very little about CGI and PHP as CGI.
Here is what I know about the system:
- Solaris 10 on 386
- Suhosin
- PHP usually works like CGI, cgiwrap ( http://cgiwrap.sourceforge.net/ ). I can not find wrapper.cgi example on the server to look.
- Shared hosting (virtual host), so I do not have access to the Apache configuration. But administrators do not help. Switching hosts is not an option.
- The Options directive cannot be overridden in .htaccess (e.g. ExecCGI).
.htaccess:
AddHandler php-handler .php
Action php-handler "/bin/test.cgi"
~ / public_html / bin / test.cgi:
#!/usr/bin/sh
echo "Content-type: text/html"
echo ""
exec "/path/to/php-cgi" 'foo.php';
/bin/foo.php:
<?php
echo "this is foo.php!";
The output of http://mysite.com/bin/test.cgi :
X-Powered-By: PHP/5.2.11 Content-type: text/html echo "Content-type: text/html" echo "" exec "/path/to//php-cgi" 'foo.php';
The output of http://mysite.com/anypage.php:
X-Powered-By: PHP/5.2.11 Content-type: text/html echo "Content-type: text/html" echo "" exec "/path/to//php-cgi" 'foo.php';
I note the following:
- PHP,
X-Powered-By .... /bin/test.cgi.- ,
exec, php. '-i' phpinfo, '-v', ... test.cgi , ( php, ).
, ?
UPDATE
- , ,
test.cgi, . , cgi, , exec, cgi. test.cgi exec "/path/to/php-cgi" -h ( , CLI).