Linux CentOS system PHP and MySQL commands are added to the environment variable _linux

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

After installing PHP and MySQL on a Linux centos system, PHP and MySQL commands need to be added to the system command in order to be easy to use, and if you perform the "php-v" command to view current PHP version information before you add it to the environment variable, you will be prompted for an error that does not exist , here are a few more ways to add PHP and MySQL to environment variables under Linux (assuming PHP, MySQL, and Apache are installed separately in/phpstudy/server/php/,/phpstudy/server/mysql/, and/ phpstudy/server/php/).

Method One:

Run commands directly

Export path= $PATH:/phpstudy/server/php/bin and Export path= $PATH:/phpstudy/server/mysql/bin and Export path= $PATH:/ Phpstudy/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 the path line in the vi ~/.bash_profile modify file to add/phpstudy/server/php/bin and/phpstudy/server/mysql/bin and/phpstudy/mysql/bin to Path After =path:home/bin a row

This method only takes effect for the current logged-on user

Method Three:

Modify the/etc/profile file to take effect permanently and take effect for all system users, adding the following two lines of code at the end of the file:

Path= $PATH:/phpstudy/server/php/bin:/phpstudy/server/mysql/bin:/phpstudy/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.

Small method: Five ways to find files under Linux

1.find– (find is the most common and powerful search command that you can use to find any file you're looking for.) )

2.locate– (Locate command is another way of writing "Find-name", but it is much faster than the latter because it does not search for a specific directory, but rather searches for a database (/var/lib/locatedb) that contains all of the local file information. The Linux system automatically creates this database and updates it automatically every day, so you won't be using the locate command to find the most recently changed files. To avoid this, you can use the UpdateDB command to manually update the database before using locate. )

3.whereis– (the Whereis command can only be used for search of program names, and only binary files (parameter-B), man description file (parameter-m), and source code files (parameter-s) are searched. If the argument is omitted, all information is returned. )

4.which– (the which command is to search the location of a system command in the path specified by the PATH variable and return the first search result.) That is, by using the which command, you can see whether a system command exists, and which location is executing the command. )

5.type– (the type command is not really a lookup command, it is used to distinguish whether a command is brought by a shell or provided by a standalone binary file outside of the shell). If a command is an external command, then the-P argument displays the path to the command, equivalent to the which command. )

Thank you for reading, I hope to help you, thank you for your support for this site!

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.