The examples in this article describe how Linux installs the PHP environment. Share to everyone for your reference, as follows:
1. Get the installation file : http://www.php.net/downloads.php php-5.3.8.tar.gz
Get the support files you need to install PHP: http://download.csdn.net/download/netlong339/1351852 libxml2-2.6.32.tar.gz
2. Installing LIBXML2
Copy CodeThe code is as follows: Tar zxvf libxml2-2.6.32.tar.gz
CD libxml2-2.6.32
./configure--PREFIX=/USR/LOCAL/LIBXML2
Make
Make install
If the installation succeeds, the bin, include, Lib, man, and share five directories will be generated under the/usr/local/libxml2/directory. When you install the configuration of the PHP5 source package later, you specify the location where the LIBXML2 library files are installed by adding the "--with-libxml-dir=/usr/local/libxml2" option in the options for the Configure command.
3. Installing PHP5
Copy CodeThe code is as follows: #tar ZVXF php-5.3.8.tar.gz
#cd php-5.3.8
#./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--WITH-APXS=/USR/LOCAL/APACHE2/BIN/APXS \
--ENABLE-FASTCGI \
--enable-fpm
#make
#make Install
4. Reconfigure apache2 to let him support PHP
① configuration httpd.conf let Apache support PHP:
Copy CodeThe code looks like this: # vi/usr/local/apache/conf/httpd.conf
Locate AddType application/x-gzip. gz. tgz below to add the following
AddType application/x-httpd-php. PHP (with spaces in front)
AddType Application/x-httpd-php-source. PHPS (front with spaces)
② then cpopy the PHP configuration file
Copy CodeThe code is as follows: CP Php-5.3.8/php.ini.dist/usr/local/php/lib/php.ini
(If there is no php.ini.dist, rename any one of the php.ini-development php.ini-production to Php.ini.dist.) )
Modify the php.ini file
Copy CodeThe code is as follows: Register_globals = On
③ Restart Apache
Copy CodeThe code is as follows: Service Apache restart
5. Test if PHP is installed successfully
Write a PHP test page info.php, and put it in Apache2/htdocs.
Enter in Browser: server address/info.php
If the PHP information can be displayed correctly, the apche+mysql+php installation is successful!
I hope this article is helpful to you in PHP programming.
Linux installation methods for configuring the PHP environment