PHP server environment variable $ _ ENV

Source: Internet
Author: User
Tags php server

 

 

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

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.