我最近在Windows 7中安裝了nginx 1.4.4和PHP 5.5.8。我運行nginx.exe和php-cgi.exe來運行服務器並運行。當我在URL中發送查詢字符串時,如果我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使用xampp的PHP時,$_REQUEST
也是空的。
一些文章告訴改變nginx配置在fastcgi_params中添加query_string。但是案件是$_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;
}
}
問題,您可以發佈從nginx的plase你的'fastcgi_param'配置。 – Fleshgrinder
@Fleshgrinder你的意思是fastcgi_param在nginx.conf中?我已經更新了該問題以包含配置。 –