How to view the PHP installation directory in centos7: 1. Use the whereis command to view. This command is used to find files. The syntax is "whereis php"; 2. Use the find command to view it. This command is used to view in the specified directory. To search for files, the syntax is "find / -name php*".
The operating environment of this article: centos 7 system, PHP version 7.1, Dell G3 computer.
The server has PHP installed, but I don’t know which directory it is installed in. You can query it in the following way.
1. Use the command whereis php,
hereis command is used to find files.
This command will search for files that meet the conditions in a specific directory. These files should be raw code, binary files, or help files.
This command can only be used to find binary files, source code files and man pages. Generally, you need to use the locate command to locate files.
Syntax
whereis [-bfmsu][-B <目录>...][-M <目录>...][-S <目录>...][文件...]
Parameters
-b Only search binary files.
-B
-f does not display the path name before the file name.
-m Only search for documentation.
-M
-s Only search original code files.
-S
-u Find files that do not contain the specified type.
The example is as follows:
php: /usr/bin/php /etc/php.ini /etc/php.d /usr/include/php /usr/share/php /usr/share/man/man1/php.1.gz
Where:
/usr/bin/php is the path to the executable file;
/ etc/php.ini is the path to the PHP configuration file;
/etc/php.d is the path to other PHP-related configuration files;
/usr/include/php is the path to the PHP extension file;
/usr/share/php is the path to the shared file;
/usr/share/man/man1/php.1.gz is PHP related information.
2. Use the find command to find the PHP installation directory
The find command is used to find files in the specified directory. Any string preceding the parameter will be treated as the name of the directory to be searched. If you use this command without setting any parameters, the find command will search for subdirectories and files in the current directory. And all found subdirectories and files will be displayed.
Grammar
find path -option [ -print ] [ -exec -ok command ] {} \;
Examples are as follows:
find / -name php*
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to check the php installation directory in centos7. For more information, please follow other related articles on the PHP Chinese website!