Home >Backend Development >PHP Problem >How to find the installation path of php in linux

How to find the installation path of php in linux

PHPz
PHPzOriginal
2023-03-23 16:53:191965browse

In the process of using the Linux operating system, sometimes it is necessary to find the installation path of the installed PHP program in order to perform related operations. So how to find the installation path of PHP in the Linux system? Here are some specific ways.

1. Use the which command to find PHP

Use the which command to quickly find the PHP path you installed. The specific command is as follows:

which php

Enter After the command, the PHP program installation path in the current system will be output, as shown below:

/usr/bin/php

2. Use the whereis command to find PHP

Use the whereis command to also find PHP The installation path of the program, the specific command is as follows:

whereis php

After entering the command, the installation path of the PHP program in the current system will be output, as shown below:

php: /usr/bin/php /usr/share/php /usr/share/man/man1/php.1.gz

Among them, the first path is the system default The PHP installation path, the second path is the source code path of the PHP program, and the third path is the help document path of the PHP program.

3. Use the find command to find PHP

Use the find command to find all files containing php on the system to find the installation path of the PHP program. The specific command is as follows:

find / -name php

This command will search for files containing php in the root directory. Since it needs to be searched in full, it will be slow, but it can also find all PHP program installation paths.

Summary

Whether you use the which command, whereis command or find command, you can quickly find the PHP program installation path on the Linux system. In practical applications, appropriate search methods can be selected according to different needs to improve efficiency.

The above is the detailed content of How to find the installation path of php in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn