Home  >  Article  >  Backend Development  >  Linux looks at the php installation path

Linux looks at the php installation path

王林
王林Original
2023-05-07 12:50:10706browse

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

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

/usr/bin/php
  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
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
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
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
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
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!

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
Previous article:php code-behindNext article:php code-behind