How to add php and mysql commands to environment variables under Linux CentOS system

WBOY
Release: 2016-07-25 09:13:32
Original
1276 people have browsed it
How to add php and mysql commands to environment variables
under Linux CentOS system After installing php and MySQL on the Linux CentOS system, for ease of use, you need to add the php and mysql commands to the system commands. If they are not added to the environment variables before, execute the "php -v" command to view the current php version information. , an error that the command does not exist will be prompted. Below we will introduce in detail how to add php and mysql to the environment variables under Linux (assuming that php and mysql are installed in /usr/local/webserver/php/ and /usr/ respectively. local/webserver/mysql/).

Method 1: Directly run the commands export PATH=$PATH:/usr/local/webserver/php/bin and export PATH=$PATH:/usr/local/webserver/mysql/bin
Using this method will only be effective for the current session, which means that whenever you log out or log out of the system, the PATH setting will become invalid and will only take effect temporarily.

Method 2: Execute vi ~/.bash_profile to modify the PATH line in the file, and add /usr/local/webserver/php/bin and /usr/local/webserver/mysql/bin after the PATH=$PATHHOME/bin line
This method only takes effect for the currently logged in user

Method 3: Modify the /etc/profile file to make it permanent and effective for all system users. Add the following two lines of code at the end of the file
[php]
  1. view plaincopy
  2. PATH=$PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin
  3. export PATH
Copy code


Finally: Execute the command source /etc/profile or execute the point command ./profile to make the modification effective. After execution, you can use the echo $PATH command to check whether the addition is successful. Regarding php technical issues welcome to join the group to discuss: 256271784, verification code: cxy, if you don’t write it, the verification will not be passed.




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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!