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

Source: Internet
Author: User
Tags mysql commands php and mysql

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

Related Article

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.