Home > Backend Development > PHP Tutorial > ngnix - Why can't php get the value of $_GET?

ngnix - Why can't php get the value of $_GET?

WBOY
Release: 2016-09-02 08:57:05
Original
1308 people have browsed it

There are no exceptions when developing on this machine. However, there are various problems when deploying to the server. The parameters of REQUEST_URI are obviously valuable, but QUERY_STRING is empty... orz
is when developing on this machine. Use apache and use ngnix for deployment. Is it related to the configuration?

<code>array:32 [▼
  "USER" => "www-data"
  "HOME" => "/var/www"
  "FCGI_ROLE" => "RESPONDER"
  "QUERY_STRING" => ""
  "REQUEST_METHOD" => "GET"
  "CONTENT_TYPE" => ""
  "CONTENT_LENGTH" => ""
  "SCRIPT_FILENAME" => "/home/ubuntu/mfphp/index.php"
  "SCRIPT_NAME" => "/index.php"
  "REQUEST_URI" => "/Index/test/?id=3&page=1&size=10"
  "DOCUMENT_URI" => "/index.php"
  "DOCUMENT_ROOT" => "/home/ubuntu/mfphp"
  "SERVER_PROTOCOL" => "HTTP/1.1"
  "GATEWAY_INTERFACE" => "CGI/1.1"
  "SERVER_SOFTWARE" => "nginx/1.4.6"
  "REMOTE_ADDR" => "223.73.98.45"
  "REMOTE_PORT" => "23487"
  "SERVER_ADDR" => "10.104.44.175"
  "SERVER_PORT" => "80"
  "SERVER_NAME" => "gb.qiangtaoli.com"
  "REDIRECT_STATUS" => "200"
  "HTTP_HOST" => "gb.qiangtaoli.com"
  "HTTP_CONNECTION" => "keep-alive"
  "HTTP_CACHE_CONTROL" => "max-age=0"
  "HTTP_UPGRADE_INSECURE_REQUESTS" => "1"
  "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
  "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
  "HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch"
  "HTTP_ACCEPT_LANGUAGE" => "zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4"
  "PHP_SELF" => "/index.php"
  "REQUEST_TIME_FLOAT" => 1472734757.8597
  "REQUEST_TIME" => 1472734757
]</code>
Copy after login
Copy after login

Reply content:

There are no exceptions when developing on this machine. However, there are various problems when deploying to the server. The parameters of REQUEST_URI are obviously valuable, but QUERY_STRING is empty... orz
is when developing on this machine. Use apache and use ngnix for deployment. Is it related to the configuration?

<code>array:32 [▼
  "USER" => "www-data"
  "HOME" => "/var/www"
  "FCGI_ROLE" => "RESPONDER"
  "QUERY_STRING" => ""
  "REQUEST_METHOD" => "GET"
  "CONTENT_TYPE" => ""
  "CONTENT_LENGTH" => ""
  "SCRIPT_FILENAME" => "/home/ubuntu/mfphp/index.php"
  "SCRIPT_NAME" => "/index.php"
  "REQUEST_URI" => "/Index/test/?id=3&page=1&size=10"
  "DOCUMENT_URI" => "/index.php"
  "DOCUMENT_ROOT" => "/home/ubuntu/mfphp"
  "SERVER_PROTOCOL" => "HTTP/1.1"
  "GATEWAY_INTERFACE" => "CGI/1.1"
  "SERVER_SOFTWARE" => "nginx/1.4.6"
  "REMOTE_ADDR" => "223.73.98.45"
  "REMOTE_PORT" => "23487"
  "SERVER_ADDR" => "10.104.44.175"
  "SERVER_PORT" => "80"
  "SERVER_NAME" => "gb.qiangtaoli.com"
  "REDIRECT_STATUS" => "200"
  "HTTP_HOST" => "gb.qiangtaoli.com"
  "HTTP_CONNECTION" => "keep-alive"
  "HTTP_CACHE_CONTROL" => "max-age=0"
  "HTTP_UPGRADE_INSECURE_REQUESTS" => "1"
  "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
  "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
  "HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch"
  "HTTP_ACCEPT_LANGUAGE" => "zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4"
  "PHP_SELF" => "/index.php"
  "REQUEST_TIME_FLOAT" => 1472734757.8597
  "REQUEST_TIME" => 1472734757
]</code>
Copy after login
Copy after login

<code class="php">
phpinfo();
</code>
Copy after login

See if there is value

Look at the value of variables_order in php.ini. It’s OK to modify it like this

<code class="php">variables_order="EGPCS"</code>
Copy after login
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template