Home >Operation and Maintenance >Linux Operation and Maintenance >How to install php under linux
How to install PHP under Linux: 1. Download the PHP source code; 2. Unzip the installation package; 3. Configure the installation variables; 4. Compile the source code; 5. Switch to the root user and execute the [make install] command to install php.
Environment:
linux system
php5.6
The specific steps are as follows:
(Recommended tutorial: linux video tutorial)
1. Download the php source code
Download the php installation source code package from the official website of php.
2. 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
3. Configure installation variables
Open the decompressed directory - execute the command:
cd php-5.5.11
Configure the installation environment - execute the command:
(recommended graphic tutorial : linux tutorial)
./configure --prefix=/usr/local/servers/php
"/usr/local/servers/php" is the installation path, which can be changed to your favorite installation path.
4. Compile the source code
Execute the compilation command in the decompression directory:
make
5. 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 under linux. For more information, please follow other related articles on the PHP Chinese website!