I ran into a problem with path_info using apache2/mod_fastcgi, so I configured apache to use php as regular cgi, and have the same exact problems. There are basicly two problems, first, --discard-path causes PHP to parse itself rather than the script, so I think discard-path is basicly a bad idea. You cannot use --discard-path with apache and cgi. The second is that (after compiling without --discard-path) path_info does not work:
works: http://localhost/info.php fails with 500 error: http://localhost/info.php/test My apache config is: ScriptAlias /php/ /path/to/php/bin/ AddType application/x-httpd-php .php Action application/x-httpd-php /php/php-cgi What happens is that php tries to parse the file /info.php/test rather than /info.php. Basicly, mod_cgi and mod_fastcgi do not provide the correct information for several environment variables to php when configured this way. path_info, path_translated, script_name and script_filename are all wrong. According to CGI specs (linked to from apache docs), with the url http://localhost/info.php/test?a=b I *should* get: PATH_INFO=/test PATH_TRANSLATED=/docroot/test SCRIPT_NAME=/info.php REQUEST_URI=/info.php/test?a=b SCRIPT_FILENAME=/docroot/info.php QUERY_STRING=a=b REQUEST_URI and SCRIPT_FILENAME are not part of CGI spec, but are apache specific. What I *really* get is: PATH_INFO=/info.php/test PATH_TRANSLATED=/docroot/info.php/test SCRIPT_NAME=/php/php-cgi (from the Action setting I suppose) REQUEST_URI=/info.php/test?a=b SCRIPT_FILENAME=/path/to/php/bin/php-cgi (Action setting translated) QUERY_STRING=a=b Further, PATH_INFO should always be empty if no extra path info is used in the request (ie. http://localhost/info.php). PHP_SELF is also quite wrong since it is basicly PATH_INFO. Now, if I set up PHP to use the CGI handler in this way: Options +ExecCGI AddHandler cgi-script .php And add a bang line to my script: #!/path/to/php-cgi I get the correct settings (well, I did that with perl and it gets the correct stuff, so php should as well). However having to do this is evil, since PHP apps typically do not have the bang line, we keep changing the executable names, people install php to different locations, and so forth. I also beleive this is the same reason path_info has never worked in cgi under IIS. So, unless anyone has a better idea, or my apache config is extremely wrong, I'm going to rip apart the whole file handling situation in php-cgi and fix it to work right, and provide the correct CGI spec'd values. This will involve parsing the above variables, figuring out what the right settings are, doing at least one stat() call (more if extra path_info is used), and modifying the environment prior to calling php_request_startup. This will also fix my fastcgi problem as they are the same. I already have part of the patch done that fix path_info and path_translated. Shane -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php