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

How to set php environment variables in linux

coldplay.xixi
Release: 2023-03-09 07:12:02
Original
3302 people have browsed it

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
Copy after login

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
Copy after login

3, save and exit, execute the command to make the environment variables take effect

source /etc/profile
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template