PHP Server environment variable $_env_php tutorial

Source: Internet
Author: User
Tags php server
PHP $_env variables

$_env 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 accepts server-side environment variables and transforms them into array elements that you can try to print directly:

Print_r ($_ENV);

is limited to space, where the printed results are no longer listed, and the results printed on different servers may be completely different.

$_env array elements

The elements in the $_ENV array (array cells) vary greatly with the server environment, so the complete list cannot be listed as $_server. The following are the more common elements that the $_env array contains:

$_server[' path ': Environment variable path.

$_server[' CLASSPATH ': System CLASSPATH path.

$_server[' lib ': System LIB Library path.

$_server[' include ': System include path, note the PHP contains the path is not the same.

$_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 ': The current process ID number.

$_server[' number_of_processors ': Number of system CPUs.

The reason and solution of the empty $_env

If the printout $_env is empty, you can check the configuration of the php.ini:

Variables_order = "Egpcs"

The above configuration represents the source and order of external variables accepted by PHP, EGPCS is the abbreviation for environment, Get, Post, Cookies, and server. If E is missing from Variables_order's configuration, then PHP cannot accept the environment variable, then $_env is empty.

Original address: http://www.5idev.com/p-php_env.shtml

http://www.bkjia.com/PHPjc/478499.html www.bkjia.com true http://www.bkjia.com/PHPjc/478499.html techarticle PHP $_env variable $_env 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 only ...

  • 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.