Several methods of adding PHP and MySQL commands to environment variables under the CentOS

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.