I recently installed nginx 1.4.4 and PHP 5.5.8 in Windows 7. I run nginx.exe and php-cgi.exe to run the server and works. When I send a query string in URL, if I print_r($_GET)
it has the value from query string. But if I print_r($_REQUEST)
, the $_REQUEST
is only an empty array. I have followed some other questions in stackoverflow and all I found is checking request_order and variables_order. in php.ini
Here is my current configuration in php.ini for request_order and variables_order:
; This directive determines which super global arrays are registered when PHP
; starts up. G,P,C,E & S are abbreviations for the following respective super
; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty
; paid for the registration of these arrays and because ENV is not as commonly
; used as the others, ENV is not recommended on productions servers. You
; can still get access to the environment variables through getenv() should you
; need to.
; Default Value: "EGPCS"
; Development Value: "GPCS"
; Production Value: "GPCS";
; http://php.net/variables-order
variables_order="GPCS"
; This directive determines which super global data (G,P,C,E & S) should
; be registered into the super global array REQUEST. If so, it also determines
; the order in which that data is registered. The values for this directive are
; specified in the same manner as the variables_order directive, EXCEPT one.
; Leaving this value empty will cause PHP to use the value set in the
; variables_order directive. It does not mean it will leave the super globals
; array REQUEST empty.
; Default Value: None
; Development Value: "GP"
; Production Value: "GP"
; http://php.net/request-order
request_order="GP"
I also found an answer to turn off auto_globals_jit, but it doesn't work.
I have a working installed xampp 1.8.3, which is working in apache server. But when the nginx use xampp's PHP, the $_REQUEST
is empty too.
Some articles tell to change nginx config to add query_string in fastcgi_params. But the case is the $_SERVER['QUERY_STRING']
is empty. But for my case, the $_SERVER['QUERY_STRING']
contains value. I still try it but it doesn't work either.
What's still missing? Thank you.
EDIT
Here is my nginx server configuration (I use Code Igniter, so I follow http://wiki.nginx.org/Codeigniter for the configuration:
server {
listen 80;
server_name local.dev.com;
root html/dev;
autoindex on;
index index.php;
location / {
try_files $uri $uri/ /index.php;
location = /index.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param SCRIPT_FILENAME D:/nginx/html/dev$fastcgi_script_name;
include fastcgi_params;
}
}
location ~ \.php$ {
return 444;
}
}