PHP: PHP - PHP CGI |
PHP CGI- , - PHP - ( Apache) , , chroot setuid . PHP cgi-bin -. CERT (, ) CA-96.11 - cgi-bin. PHP , , :
: http://my.host/cgi-bin/php?/etc/passwd
, (URL) , CGI . , .
PHP CGI- .
: http://my.host/cgi-bin/php/secret/doc.html
, PHP, /secret/doc.html, , CGI- , - (, Action Apache) , , http://my.host/secret/script.php PHP. - /secret, http://my.host/cgi-bin/php/secret/script.php. , , /secret/script.php , /cgi-bin/php. , /cgi-bin/php, , , .
PHP, --enable-force-cgi-redirect, doc_root user_dir , . , .
, , IP-, . - PHP- , --enable-force-cgi-redirect PHP. , , http://my.host/cgi-bin/php/dir/script.php http://my.host/dir/script.php, .
- Apache AddHandler Action ( ).
2: --enable-force-cgi-redirect
, PHP, http://my.host/cgi-bin/php/secretdir/script.php. , PHP , -.
- Apache :
Action php-script /cgi-bin/php AddHandler php-script .php |
- Apache, REDIRECT_STATUS, CGI-. , - , , CGI-.
, , - . , , , , , HTML-, (, ), , . , , CGI-.
, , , , doc_root, -.
PHP-, doc_root , PHP_DOCUMENT_ROOT. , PHP CGI, doc_root . , , ( user_dir, ).
- user_dir. , user_dir , doc_root. http://my.host/~user/doc.php , , doc_root ~user/doc.php (, ~).
public_php , , http://my.host/~user/doc.php, doc.php, , public_php. , /home/user, /home/user/public_php/doc.php.
user_dir doc_root, - .
- PHP -, /usr/local/bin. , :
#!/usr/local/bin/php |
. , , CGI-, Perl, sh , #! .
PATH_INFO PATH_TRANSLATED, PHP --enable-discard-path.
PHP.SU: | PHP |