Home  >  Article  >  Backend Development  >  How to set php environment variables in linux

How to set php environment variables in linux

coldplay.xixi
coldplay.xixiOriginal
2021-03-26 17:54:413240browse

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.

How to set php environment variables in linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn