Add php and mysql commands to environment variables in CentOS

Source: Internet
Author: User
Tags mysql commands
In CentOS, how does one add PHP and mysql commands to environment variables? after installing php and MySQL on LinuxCentOS, you need to add the php and mysql commands to the system commands for ease of use, if you run the & ldquo; php-v & rdquo; command to view the current php version information before the environment variable is added, an error indicating that the command does not exist will be prompted, next we will introduce in detail how to add php and mysql to the environment in linux.

In CentOS, how to add PHP and mysql commands to environment variables and install php and MySQL on CentOS Linux, you need to add the php and mysql commands to the system command. if you do not add the php and mysql commands to the environment variables, run the "php-v" command to view the current php version information, A message indicating that the command does not exist is displayed, next we will introduce in detail how to add php and mysql to environment variables in linux (false php and mysql are installed in/usr/local/webserver/php/and/usr/respectively/ local/webserver/mysql ).

Method 1: run the command export PATH = $ PATH:/usr/local/webserver/php/bin and export PATH = $ PATH:/usr/local/webserver/mysql/bin.

This method is only valid for the current session. that is to say, the PATH setting will expire after the system is logged out or logged out, but will only take effect temporarily.

Method 2: execute vi ~ /. Modify the PATH line in the bash_profile file and add/usr/local/webserver/php/bin and/usr/local/webserver/mysql/bin to PATH = $ PATH: $ HOME/bin after a row

This method takes effect only for the current login user

Method 3: modify the/etc/profile file to make it permanently effective 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/binexport PATH

Finally, run the source/etc/profile command or run the./profile command to make the modification take effect. after the command is executed, run the echo $ PATH command to check whether the modification is successfully added.

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.