Linux looks at the php installation path

王林
Release: 2023-05-07 12:50:10
Original
721 people have browsed it

In Linux systems, the PHP installation path can be viewed in a variety of ways. Several common methods will be introduced below.

  1. Using the which command

The which command can be used to find the location of a command or program in the file system. Enter the following command in the terminal:

which php
Copy after login

If PHP is already installed and in the system path, output similar to the following will be displayed:

/usr/bin/php
Copy after login
  1. Use the whereis command
# The ##whereis command can also be used to find the location of a command or program. The difference is that it will also find executable files, help documents, and source code files. Enter the following command in the terminal:

whereis php
Copy after login
If PHP has been installed and is in the system path, output similar to the following will be displayed:

php: /usr/bin/php /etc/php /usr/include/php /usr/share/php /usr/share/man/man1/php.1.gz
Copy after login
where /usr/bin/php is the location of the PHP command ,/etc/php is the location of the PHP configuration file.

    Use the where command
The where command can also be used to find the location of a command or program, similar to the which command, but it will list all matching results . Enter the following command in the terminal:

where php
Copy after login
If PHP has been installed and is in the system path, output similar to the following will be displayed:

/usr/bin/php
/usr/include/php
/usr/share/php
Copy after login
where /usr/bin/php is the location of the PHP command .

    Use the locate command
The locate command can be used to find the location of a specified file or directory. It will search all files in the system and cache the results in a database. So the query speed is very fast. Enter the following command in the terminal:

locate php
Copy after login
If PHP is installed and in the system path, all files and directories containing the "php" keyword will be displayed, including the installation location of PHP.

Any of the above methods can be used to find the installation path of PHP. Generally speaking, PHP's command path is /usr/bin/php, and its configuration file path is /etc/php. You can use either of them to view the PHP installation path.

The above is the detailed content of Linux looks at the php installation path. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template