I installed the lighttpd web server on my windows computer and I have a problem: the $_GET
and $_POST
variables are not defined in the PHP files.
For example, I have this simple script ( tmp.php
):
<?php echo "x: '" . $_GET ['x'] . "'<br />"; ?>
When I go to the address: http://localhost/tmp.php?x=123
I get this error message:
Notice: Undefined index: x in /srv/www/htdocs/tmp.php on line 3 x: ''
While I put the same file on shared hosting, I get:
x: '123'
Also php command:
empty ($_GET)
returns true.
Same for all $ _POST variables.
Is there a wrong configuration in my php.ini
?
Command:
print_r($_SERVER);
gives the following result:
Array ( [SERVER_SOFTWARE] => lighttpd/1.4.20 [SERVER_NAME] => localhost [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [SERVER_PORT] => 80 [SERVER_ADDR] => 0.0.0.0 [REQUEST_METHOD] => GET [REDIRECT_STATUS] => 200 [QUERY_STRING] => x=123 [REQUEST_URI] => /tmp.php?x=123 [REMOTE_ADDR] => 127.0.0.1 [REMOTE_PORT] => 3150 [CONTENT_LENGTH] => 0 [SCRIPT_FILENAME] => /srv/www/htdocs/tmp.php [SCRIPT_NAME] => /srv/www/htdocs/tmp.php [DOCUMENT_ROOT] => [SYSTEMROOT] => C:\WINNT [HTTP_ACCEPT] => *
So, the value x=123
exists in $_SERVER['QUERY_STRING']
and in $_SERVER['REQUEST_URI']
, but I donโt know how to get it.
source share