Linux method of setting PHP environment variables: First edit the environment variable file, the code is [vim /etc/profile]; then add the introduction of the PHP running directory at the end of the file; finally save and exit, execute the command to set the environment variables Take effect.
The operating environment of this tutorial: Windows 7 system, PHP version 5.6, DELL G3 computer.
How to set php environment variables in linux:
1, edit the environment variable file
vim /etc/profile
2, add the introduction of php running directory at the end of the file , mine is in /usr/local/php/bin
export PATH=$PATH:/usr/local/php/bin
3, save and exit, execute the command to make the environment variables take effect
source /etc/profile
4, check whether the configuration is successful, execute php -v, return The version number is successful
[root@localhost bin]# php -v PHP 7.3.0 (cli) (built: Apr 30 2020 20:49:48) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
Related video recommendations: PHP programming from entry to proficiency
The above is the detailed content of How to set php environment variables in linux. For more information, please follow other related articles on the PHP Chinese website!