After installing PHP and MySQL on the Linux CentOS system, for convenience, PHP and MySQL commands need to be added to the system commands, if you do not add to the environment variable, execute "php-v" command to view the current PHP version information, will prompt the command does not exist error , let's describe in detail how PHP and MySQL are added to environment variables under Linux (assuming PHP and MySQL are installed in/usr/local/webserver/php/and/usr/local/webserver/mysql/respectively) Medium).
Method One: Run the command directly export path= $PATH:/usr/local/webserver/php/bin and Export path= $PATH:/usr/local/webserver/mysql/bin
With this method, only the current session is valid, that is, the PATH setting is invalidated whenever the system is logged out or logged off, but it is temporarily in effect.
Method Two: Execute VI ~/.bash_profile Modify the PATH line in the file, add/usr/local/webserver/php/bin and/usr/local/webserver/mysql/bin to path= $PATH: $ Home/bin after a row
This method only takes effect on the currently logged on user
Method Three: Modify the/etc/profile file to make it permanent, and take effect for all system users, add the following two lines of code at the end of the file
Path= $PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin
Export PATH
Finally: Executes the command source/etc/profile or execution Point command./profile make its modifications effective, and you can see whether the add succeeds through the Echo $PATH command.
How to add php and MySQL commands to environment variables under the Linux CentOS system