Operating system: CentOS5.6
Environment: Apache2.2 Installation Successful, viewable: http://blog.csdn.net/dabao_java/article/details/24854719
MYSQL5.5 has been installed successfully, viewable: http://blog.csdn.net/dabao_java/article/details/25022215
1. Download PHP source code
http://www.php.net/downloads.php
2. Choice: php-5.3.28.tar.gz
3. Upload to Linux/root folder when download is complete
4.cd/root
TAR-ZXVF php-5.3.28.tar.gz
CD php-5.3.28
./configure--PREFIX=/USR/LOCAL/PHP5--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/ Lib--enable-track-vars--with-xml
Tip: Configure:error:xml2-config not found. Please check your LIBXML2 installation.
It is recommended that you install the latest version of the library files required by PHP5, such as LIBXML2, Libmcrypt, and GD2 libraries, before installing PHP. The GD2 library is installed to allow PHP5 to support GIF, PNG, and JPEG picture formats, so you must install the latest zlib, libpng, FreeType, and JPEGSRC library files before installing the GD2 library.
Autoconf-2.61.tar.gz
Freetype-2.3.5.tar.gz
Gd-2.0.35.tar.gz
Jpegsrc.v6b.tar.gz
Libmcrypt-2.5.8.tar.gz
Libpng-1.2.31.tar.gz
Libxml2-2.6.30.tar.gz
Zlib-1.2.3.tar.gz
Zendoptimizer-3.2.6-linux-glibc21-i386.tar.gz
Phpmyadmin-3.0.0-rc1-all-languages.tar.gz5.
Install libxml2-2.7.8.tar.gz
Libxml2-2.7.8.tar.gz
Download: http://download.chinaunix.net/download.php?id=35177&ResourceID=6095
Cd/root
TAR–ZXVF libxml2-2.7.8.tar.gz
Cd libxml2-2.7.8
./configure--prefix=/usr/local/libxml2/
May prompt installation failure
Rpm-aq|grep-i Libxml See if the system is installed
Errors that occurred in the LIBXML2 installation:
Cannot remove ' Libtoolt ': No such file or directory
Workaround:
modifying Configure Files
$ vim Configure
Delete this line: $RM "$cfgfile"
Re-run $./configure
Make
Make install
New execution:
./configure--PREFIX=/USR/LOCAL/PHP5--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-
Path=/usr/local/php5/etc/php.ini--with-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-
Mysql=mysqlnd--without-pdo-sqlite--without-sqlite3--without-sqlite--enable-mbstring--with-
OpenSSL--with-mhash--with-mcrypt--with-gettext--with-zlib-dir=/usr/local/zlib--enable-zip--
Enable-sockets--enable-soap--with-xmlrpc--with-libxml-dir--with-zlib=/usr/local/zlib/--with-mysql=/usr/local/ MySQL--with-mcrypt
Make install success:
5. Configure Apache and PHP integration
Cp/usr/local/src/php-5.3.16/php.ini-development/usr/local/php/lib/php.ini
Copy the original php.ini-development in the source code to the/usr/local/php/lib/php.ini and rename it to PHP.ini
#设置apache的默认文件名次序
#AddType application/x-httpd-php. php. phtml. PhP3. Inc
#AddType Application/x-httpd-php-source. Phps
#设置php文件后缀
Disk exit
Vi/usr/local/lib/php.ini
#register-golbals = On
Disk exit
6. Test PHP
Test: Write the test.php file, which reads as follows:
<?php phpinfo ();?>
Browser input: http://127.0.0.1/test.php