PHP $ _ ENV variable
$ _ ENV is an array containing server environment variables. It is a super global variable in PHP. We can directly access it anywhere in the PHP program.
$ _ ENV only passively accepts server-side environment variables and converts them into array elements. You can print them directly:
Print_r ($ _ ENV );
The printed results are not listed here, and the printed results may be completely different on different servers.
$ _ ENV array elements
Elements (array units) in the $ _ ENV array vary greatly with the SERVER environment, so they cannot list the complete list as $ _ SERVER does. The following are more common elements contained in the $ _ ENV array:
$ _ SERVER ['path']: PATH of the environment variable.
$ _ SERVER ['classpath']: System CLASSPATH path.
$ _ SERVER ['lib']: System LIB library path.
$ _ SERVER ['include ']: system INCLUDE path. Note that it is different from PHP's Include path.
$ _ SERVER ['OS']: operating system type.
$ _ SERVER ['lang ']: system language, such as en_US or zh_CN.
$ _ SERVER ['pwd']: current working directory.
$ _ SERVER ['temp ']: System TEMP path.
$ _ SERVER ['ap _ PARENT_PID ']: ID of the current process.
$ _ SERVER ['Number _ OF_PROCESSORS ']: NUMBER of system CPUs.
$ _ Causes and solutions for null ENV
If the output $ _ ENV is empty, check the configuration of php. ini:
Variables_order = "EGPCS"
The above configuration indicates the sources and sequence of external variables accepted by PHP. EGPCS are short for Environment, Get, Post, Cookies, and Server. If E is missing in the configuration of variables_order, PHP cannot accept environment variables, and $ _ ENV is empty.
Address: http://www.5idev.com/p-php_env.shtml