PHP installation depends on the MySQL environment, before installation, you need to check whether MySQL installation
I. Environment
System: CentOS 6.4x64 Minimized installation
ip:192.168.3.54
Second, installation
Check the system environment before installing
[root@rsync-3 ~]# netstat-anpt |egrep ' 3306|80 ' tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1609/ mysqld TCP 0 0::: + :::* LISTEN 1739/httpd [root@rsync-3 ~]#/usr/local/apache/bin/ Apachectl-vserver version:apache/2.4.12 (Unix) Server built: may 5 15:44:15[root@rsync-3 ~]# mysql-u Roo T-plyao36843-h 127.0.0.1-e ' select version (); ' +------------+| Version () |+------------+| 5.5.37-log |+------------+
Basic library files required to install PHP
Yum install-y zlib libxml libjpeg freetype libpng gd Curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel Libpng-devel Gd-devel Curl-devel Libxslt-devel
Source Installation Libiconv
[Root@rsync-3 ~]# wget [root@rsync-3 ~]# tar xf libiconv-1.14.tar.gz [root@rsync-3 ~]# cd libiconv-1.14[root@rsync-3 libic onv-1.14]#./configure --prefix=/usr/local/libiconv [root@rsync-3 libiconv-1.14]# make && make install
Install PHP
[Root@rsync-3 ~]# tar XF php-5.4.29.tar.gz[root@rsync-3 ~]# cd php-5.4.29[root@rsync-3 php-5.4.29]#./configure \>--p refix=/usr/local/php-5.4.39 \>--with-apxs=/usr/local/apache/bin/apxs \>--with-mysql=/usr/local/mysql \>- -with-xmlrpc \>--with-openssl \>--with-zlib \>--with-freetype-dir \>--with-gd \>--with-jpeg-dir \> --with-png-dir \>--with-iconv=/usr/local/libiconv \>--enable-short-tags \>--enable-sockets \>-- Enable-zend-multibyte \ #该参数已被废弃 >--enable-soap \>--enable-mbstring \>--enable-static \>--enable-gd-nat Ive-ttf \>--with-curl \>--with-xsl \>--enable-ftp \>--with-libxml-dir# start compiling file configure:warning: Unrecognized options:--enable-zend-multibytechecking for grep that handles long lines and-e .../bin/grepchecking for EGR EP .../bin/grep-echecking for a sed this does not truncate output .../bin/sedchecking build system type ... X86_64-unknown -linux-gnuchecking Host system Type ... X86_64-unknowN-linux-gnuchecking target system Type ... x86_64-unknown-linux-gnuchecking for cc ... Ccchecking whether the C compiler works ... yeschecking for C compiler default output file name ... a.outchecking for suffix of executables checking whether we is cross compiling ... nochecking for suffix of object files ... ochecking whether W E is using the GNU C compiler ... yeschecking whether cc accepts-g ... yeschecking for CC option to accept ISO C89 ... none Neededchecking How to run the C preprocessor ... cc-echecking for ICC ... nochecking for SUNCC ... nochecking whether cc UN Derstands-c and-o together ... yeschecking how to run the C preprocessor ... cc-echecking for ANSI C header files ... Yesc Hecking for sys/types.h ... yeschecking for sys/stat.h ... yeschecking for stdlib.h ... yeschecking for string.h ... Yeschecki ng for Memory.h ... yeschecking for strings.h ... yeschecking for inttypes.h ... yeschecking for stdint.h ... yeschecking for Unistd.h yeschecking minix/config.h Usability ... NocheckinG Minix/config.h presence ... nochecking for minix/config.h ... nochecking whether it's safe to define __extensions__ ... ye Schecking whether Ln-s works ... yeschecking for System Library directory ... libchecking whether to enable runpaths ... yes Checking if compiler supports-r ... nochecking if compiler Supports-wl,-rpath,... yeschecking for gawk ... gawkchecking fo R bison ... nochecking for BYACC ... nochecking for Bison version ... invalidconfigure:WARNING:bison versions supported for Regeneration of the zend/php parsers:1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.5.1 2.6 2.6.1 2.6. 2 2.6.4 (found:none). Checking for re2c ... Noconfigure:WARNING:You would need re2c 0.13.4 or later if you want to Regener Ate PHP parsers.checking whether to enable computed goto gcc extension with re2c ... nochecking whether to force Non-pic Co De in shared modules ... nochecking whether/dev/urandom exists ... yeschecking for pthreads_cflags ...-pthreadchecking for Pthreads_lib ... Configuring SAPI moduleschecking for aolserver support ... nochecking for Apache 1.x module support via DSO through APXS ... Configu Re:error:You has the enabled Apache 1.3 support while the Your server is Apache 2. Please use the appropriate switch--with-apxs2# here to prompt us to recompile [root@rsync-3 php-5.4.29]#] using the--WITH-APXS2 parameter # modification parameter./configure \ >--prefix=/usr/local/php-5.4.39 \>--with-apxs2=/usr/local/apache/bin/apxs \ #这里根据提示使用--with-apxs2>-- With-mysql=/usr/local/mysql \>--with-xmlrpc \>--with-openssl \>--with-zlib \>--with-freetype-dir \>- -WITH-GD \>--with-jpeg-dir \>--with-png-dir \>--with-iconv=/usr/local/libiconv \>--enable-short-tags \& Gt --enable-sockets \>--enable-zend-multibyte \ #该参数已被废弃, delete and recompile >--enable-soap \>--enable-mbstring \>--ena Ble-static \>--enable-gd-native-ttf \>--with-curl \>--with-xsl \>--enable-ftp \>--with-libxml-dir[ Root@rsync-3 php-5.4.29]# make && make install[root@rsync-3 php-5.4.29]# Ln -s/usr/local/php-5.4.39/usr/local/php[root@rsync-3 php-5.4.29]# CP Php.ini-production/usr/local/php/lib/php.ini