Set php variable in Linux method

By default, already installed PHP environment, and know that PHP file after installing the path, then you can set the PHP variables by way to quickly execute a command to run PHP PHP file.

Environment: centos

 

The first step: vi ~ / .bash_profile

At the end of the file and add the following sentence:

alias php = PHP installed path

 Reference path:

alias php=/data/soft/php/bin/php

 

Step Two: After installation, you need to use the source file bash command to take effect

source ~/.bash_profile

  

source Command Description:

source command:
source command also known as " dot commands " that is a dot notation, is an internal bash command (.).
Benefits: Shell reads the specified file and Shell program in order to perform all the statements in the file
source typically used to re-execute the command just modify the initialization file to make it take effect immediately, without having to log out and back.
Usage:
. Source filename or filename
source command (coming from the C Shell) is a bash shell built-in commands; command point, is a point symbol (coming from the Bourne Shell) is another name of the source of (.).

 

The last test, you can enter php ./test.php run directly in the command box to see if there execute test.php file (there is the premise of this current path test.php file).

 

More PHP, LINUX knowledge can get public attention number:

Recommended books:

 

Guess you like

Origin www.cnblogs.com/leoyi330/p/11370432.html