If you are using the CentOS 7 operating system and need to view the PHP installation directory to locate configuration files, extensions and other related information, then you need to know some related commands and techniques. Below, we will introduce you to some methods to view the PHP installation directory on CentOS 7.
Method 1: Use the which command to view the PHP path
Before using the which command, be sure to confirm that you have successfully installed PHP on the CentOS server. Here are the steps to view the PHP path using which command:
which php
./usr/bin/php
.Viewing the PHP installation directory through which command is a conventional method. If you have installed PHP, you can find the installation path in a few seconds.
Method 2: Use the whereis command to find the PHP installation directory
The whereis command can find executable files, source code, help files and other related files in the system. Here are the steps to use the whereis command to find the PHP installation directory:
whereis php
.php: /usr/bin/php /usr/share/php /usr/share/man/man1/php.1.gz
As shown above, in different environments, the whereis command can return the PHP installation directory Different path information, but one of the most common paths is /usr/bin/php, which you can use as your PHP installation path.
Method 3: Use php.ini to view the PHP installation directory
php.ini is the main configuration file of PHP, which contains PHP-related information, including PHP installation Table of contents. Here are the steps to use php.ini to view the PHP installation directory:
php --ini
.In the output information, you will find something similar to the following:
Configuration File (php.ini) Path: /etc Loaded Configuration File: /etc/php.ini Scan for additional .ini files in: /etc/php.d Additional .ini files parsed: /etc/php.d/10-opcache.ini, /etc/php.d/20-calendar.ini, /etc/php.d/20-ctype.ini, ...
The above information tells us that the php.ini file is in the /etc directory, so you can use the following command To find the PHP installation path:
cd /etc ls -l php.ini
At this time, the terminal will return the details of the PHP installation path, similar to:lrwxrwxrwx. 1 root root 21 Nov 18 2019 /etc/php.ini -> ; /etc/php.ini-production
.
To sum up, the above are three methods to view the PHP installation directory on CentOS 7. These methods are simple and effective, and you can choose one of them based on your actual needs and operating environment. I hope this article can help you quickly locate the PHP installation directory on CentOS 7.
The above is the detailed content of How to check the php installation directory in centos7? Three ways to share. For more information, please follow other related articles on the PHP Chinese website!