PATH_INFO not available
Brought to you by:
cweiske
Some hosting environments (e.g. Dreamhost) don't expose PATH_INFO
or ORIG_PATH_INFO
, which causes problems. The required data should be available in other vars, though, such as SCRIPT_NAME
, REQUEST_URI
, etc.
Below is the output from var_dump($_SERVER)
from a Dreamhost server with this issue (w/ identifying data removed). Let me know if you need more info.
array(44) { ["PATH"]=> string(29) "/bin:/usr/bin:/sbin:/usr/sbin" ["RAILS_ENV"]=> string(10) "production" ["SCRIPT_NAME"]=> string(9) "/test.php" ["REQUEST_URI"]=> string(5) "/test" ["QUERY_STRING"]=> string(6) "query=" ["REQUEST_METHOD"]=> string(3) "GET" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["REDIRECT_URL"]=> string(5) "/test" ["REDIRECT_QUERY_STRING"]=> string(6) "query=" ["REMOTE_PORT"]=> string(5) "33523" ["SCRIPT_FILENAME"]=> string(43) "/home/xxx/xxx/test.php" ["SERVER_ADMIN"]=> string(33) "xxx" ["DOCUMENT_ROOT"]=> string(34) "/home/xxx/xxx" ["REMOTE_ADDR"]=> string(13) "xxx" ["SERVER_PORT"]=> string(2) "80" ["SERVER_ADDR"]=> string(14) "xxx" ["SERVER_NAME"]=> string(23) "xxx" ["SERVER_SOFTWARE"]=> string(6) "Apache" ["SERVER_SIGNATURE"]=> string(0) "" ["HTTP_COOKIE"]=> string(111) "xxx" ["HTTP_ACCEPT_LANGUAGE"]=> string(14) "en-US,en;q=0.8" ["HTTP_ACCEPT_ENCODING"]=> string(17) "gzip,deflate,sdch" ["HTTP_USER_AGENT"]=> string(119) "xxx" ["HTTP_ACCEPT"]=> string(74) "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" ["HTTP_CONNECTION"]=> string(5) "close" ["HTTP_HOST"]=> string(23) "xxx" ["DH_USER"]=> string(4) "xxx" ["xxx"]=> string(0) "" ["dsid"]=> string(8) "xxx" ["SCRIPT_URI"]=> string(35) "http://xxx/test" ["SCRIPT_URL"]=> string(5) "/test" ["UNIQUE_ID"]=> string(24) "xxx" ["REDIRECT_STATUS"]=> string(3) "200" ["REDIRECT_DH_USER"]=> string(4) "xxx" ["xxx"]=> string(0) "" ["REDIRECT_dsid"]=> string(8) "xxx" ["REDIRECT_SCRIPT_URI"]=> string(35) "xxx" ["REDIRECT_SCRIPT_URL"]=> string(5) "/test" ["REDIRECT_UNIQUE_ID"]=> string(24) "xxx" ["FCGI_ROLE"]=> string(9) "RESPONDER" ["PHP_SELF"]=> string(9) "/test.php" ["REQUEST_TIME_FLOAT"]=> float(1385077586.0609) ["REQUEST_TIME"]=> int(1385077586) }
Thanks for the fix. It would be easier for me to integrate it if you posted the output of var_export($_SERVER) - please do so if you can.
Could you do the same for the URL "/test.php/dummy"?
Also, do you get a PATH_INFO variable if you put "AcceptPathInfo On" in .htaccess?
Interesting. When going to
/test.php/dummy
I do get aPATH_INFO
variable, even withoutAcceptPathInfo On
in the.htaccess
(see below).Going to
/test/
, however, still does not give a PATH_INFO variable, even withAcceptPathInfo On
.But this is fine; it's like it should behave.
Do you have problems with that? Which problems?
Ya, now I'm second-guessing the whole thing. I'll have to take another look to figure out exactly what was happening. I will update this ticket with more info shortly.