Home>Article>Backend Development> Detailed explanation of how to set system variables in php
How to set system variables in php: first turn on the computer; then find "Advanced System Settings" in the control panel; then click "Environment Variables" in "System Properties"; finally add the variable value and save it .
# Recommended: "
PHP Video Tutorial》
When I see this title, I have two questions: whether to set system environment variables for php.exe, or to set environment variables for programming languages that can be called directly. Some people may be confused when talking about this, because What we often see is the first one, which is equivalent to setting a shortcut key for a certain command without having to enter the directory where the application is installed and then type the command. For example: 1. When the php.exe global environment variable is not added, we need to run php in the following directory:D:\phpStudy\php\php-5.6.27-nts\
For example,
php -v
php -m
This is very simple. Most programs set global variables in the same way. Find the computer, right-click, and open the system control system panel. There is an advanced system setting on the left, click in and you can see it. Picture steps shown below:
and
$_ENV()functions:
getenv()and
$_ENV()! Then you need to read here. There are no online tutorials on this yet, and I figured it out myself.
Proceed in three steps:
variables_order = "EGPCS"
GET, POST, COOKIE, ENV and SERVER, E stands for
ENVIRONMENT, which means environment variables!
Set the environment variables you need here, such as database account password, etc. I've made a mosaic here, it's a must.
echo getenv('DB_HOST_NAME) //或者 echo $_ENV('DB_HOST_NAME)Is that enough! Try it now!
The above is the detailed content of Detailed explanation of how to set system variables in php. For more information, please follow other related articles on the PHP Chinese website!