Home>Article>Operation and Maintenance> How to install php from the command line under linux
How to install PHP from the command line under Linux: 1. Download the PHP source code and decompress it; 2. Enter the decompression directory and configure the installation environment; 3. Execute the [make] command to compile; 4. Execute [make install] command to install.
【Download php source code】
(Recommended tutorial:linux tutorial)
From php Download the PHP installation source code package from the official website.
[Decompress the installation package]
The downloaded installation package is in compressed gz format. In Linux, you can use the built-in tool tar to decompress it. Execute the command in the directory where the installation package is located:
tar -zxvf php-5.5.11.tar.gz
[Configure installation variables]
Open the decompressed directory - execute the command:
cd php-5.5.11
Configure the installation environment - execute the command:
./configure --prefix=/usr/local/servers/php
"/usr/ "local/servers/php" is the installation path, you can change it to your favorite installation path.
[Compile source code]
Execute the compilation command in the decompression directory:
make
[Install php]
Switch to the root user-execute the command:
sudo su root
Installation-Execute command:
make install
Create soft link: Execute command:
ln -s /usr/local/servers/php/bin/php /usr/local/bin/php
Related recommendations:php training
The above is the detailed content of How to install php from the command line under linux. For more information, please follow other related articles on the PHP Chinese website!