Недавно я установил nginx 1.4.4 и PHP 5.5.8 в Windows 7. Я запускаю nginx.exe и php-cgi.exe для запуска сервера и работы. Когда я отправляю строку запроса в URL-адресе, если I print_r($_GET)
, то имеет значение из строки запроса. Но если я print_r($_REQUEST)
, $_REQUEST
является только пустой массив. Я выполнил некоторые другие вопросы в stackoverflow, и все, что я нашел, это проверка request_order и variables_order. в php.ini Вот моя текущая конфигурация в php.ini для request_order и 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"
Я также нашел ответ, чтобы выключить auto_globals_jit, но он не работает. У меня установлен установленный xampp 1.8.3, который работает на сервере Apache. Но когда nginx использует PHP xampp, $_REQUEST
тоже пуст.
В некоторых статьях сообщается об изменении конфигурации nginx для добавления query_string в fastcgi_params. Но дело в том, что $_SERVER['QUERY_STRING']
пуст. Но для моего случая $_SERVER['QUERY_STRING']
содержит значение. Я все еще стараюсь, но он тоже не работает.
Что еще не хватает? Спасибо.
EDIT
Вот моя конфигурация сервера Nginx (я использую код воспламенитель, поэтому я следую http://wiki.nginx.org/Codeigniter для конфигурации:
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;
}
}
Не могли бы вы опубликовать 'fastcgi_param' конфигурацию из Nginx Plase. – Fleshgrinder
@Fleshgrinder Вы имеете в виду fastcgi_param в nginx.conf? Я обновил вопрос, чтобы включить конфигурацию. –