How to install php under linux: 1. Download php source code; 2. Unzip the installation package; 3. Configure installation variables; 4. Compile 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 php source code
Download the php installation source package from php’s official website.
2. Decompress the installation package
The downloaded installation package is in the 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 Decompressed directory – execute the command:
cd php-5.5.11
Configure the installation environment – execute the command:
(Graphical tutorial recommendation: linux tutorial)
./configure --prefix=/usr/local/servers/php
“/usr/local/servers/php” is the installation path, you can change it 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
Install- Execute command:
make install
Create soft link: Execute command:
ln -s /usr/local/servers/php/bin/php /usr/local/bin/php