What is the reason why PHP $_env is empty?

Source: Internet
Author: User
Tags php server
$_env in PHP is an array that contains server-side environment variables. It is a super global variable in PHP, and we can access it directly from anywhere in the PHP program. $_env just passively accept the server-side environment variables and convert them to an array element, you can try to output it directly, many of them are determined by the system that PHP runs, the complete list is not possible, you need to look at the PHP server's system documentation to determine its specific environment variables. Like $_server, this is an automatic global variable that works in all scripts and does not require the global keyword to access it in the method of a function or object. In the following example, the foreach statement is used to output all the environment-related information about the server in PHP that is available to the user for viewing.

$_env documented some system environment variables (because of the actual operating system involved, so it is not possible to give a complete list of $_env).

But some friends ' $_env are empty, possibly because:
The Variables_order value of your php.ini is "gpcs", that is, the system defines the order of PHP predefined variables is get,post,cookies,server, there is no definition environment (E), You can modify the Variables_order value of the php.ini file to the order you want, such as: "Egpcs". At this point, the value of the $_env can be obtained

Egpcs Value (egpcs is environment, Get, Post, cookie, server abbreviation-this is the entire range of external variable sources in PHP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.