PHP’s $_SERVER['path_info'] does not work when there is a GET parameter. Simple solution.
Sunday, March 30th, 2008
Today, during testing of a site for a client of mine I found that for some reason $_SERVER['PATH_INFO'] is not populated although there is path_info parameters in the requested URL. Initially I suspected that fault is in my Tangra Framework for PHP but after a quick phpinfo() I found that the problem is with the PHP itselft. Examples that describe the situation:
- With requested URI http://test.myhost/index.php/_lang-en/ everything works as expected, i.e. $_SERVER['PATH_INFO'] contains /_lang-en/.
- With requested URI http://test.myhost/index.php?someparam=1/_lang-en/ $_SERVER['PATH_INFO'] is not set at all. The problem is that when you have GET parameter(s) in your URI, PATH_INFO for some reason is not populated.
The solution: (more…)

