If you perform the "php-v" command to see the current PHP version information before you add it to the environment variable, you will be prompted for an error that does not exist, and here's how to add PHP and MySQL to the environment variables under Linux.
Suppose PHP and MySQL are installed separately in/usr/local/webserver/php/and/usr/local/webserver/mysql/.
Method One: Direct Run command export path= $PATH:/usr/local/webserver/php/bin and Export path= $PATH:/usr/local/webserver/mysql/bin
Using this method only works for the current session, which means that the PATH setting will expire whenever the system is logged on or off, but only temporarily.
Method Two: Perform 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: $ After home/bin a row
This method only takes effect for the current logged-on user
Method Three: Modify the/etc/profile file to make it permanent and effective for all system users, adding 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 the changes take effect, and you can see whether you added success through the Echo $PATH command.