Why is PHP not seeing my query string?

parameters, php, query-string

Solution

http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModRewrite

At the bottom:

"If you wanna pass the Query String (?foo=bar) to the rewrite destination you have to explicitly match it:"

And the alternative is to read it through $_SERVER['REQUEST_URI']

Problem

This phpinfo() demonstrates the problem. I'm passing the URL a query string of: ``` ?qwerty=asdfg ``` As a result, I'm expecting it to list these two PHP variables: ``` _REQUEST["qwerty"] asdfg _GET["qwerty"] asdfg ``` And also this query string: ``` _SERVER["QUERY_STRING"] qwerty=asdfg ``` However, it's not working. None of these variables seem to be set at all. I'm using lighttpd. This may or may not be related to the problem, but my greengar.com-lighttpd.conf looks like this, because I'm using WordPress for most of the domain's pages: ``` ### Generated by Elliot ### Wordpress: http://www.greengar.com url.rewrite += ( "^/(wp-.+).*/?" => "$0", "^/(blog/wp-.+).*/?" => "$0", "^/(.*.php)" => "$0", "^/(.*.pdf)" => "$0", "^/(.*.png)" => "$0", "^/(.*.html)" => "$0", "^/(.*.ico)" => "$0", "^/(.*.gif)" => "$0", "^/(.*.txt)" => "$0", "^/(images).*/?" => "$0", "^/(sitemap.xml)" => "$0", "^/(xmlrpc.php)" => "$0", "^/(.+)/?$" => "/index.php/$1" ) ``` Again, I don't know for sure whether this is related to the problem. My question is: why isn't PHP seeing the query string? And how do I fix it? Here's a normal phpinfo() which successfully sees the query string. This is running on a different server, which is running Apache.

Original source