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
[[email protected] ~]# netstat -anpt |egrep ' 3306|80 ' tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1609/mysqld tcp 0 0 :::80 :::* LISTEN 1739/httpd [[email protected] ~]# /usr/local/apache/bin/apachectl -vserver version: apache/2.4.12 (Unix) Server built: may 5 2015 15:44:15[[email protected] ~]# mysql -u root -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
[Email protected] ~]# wget [[email protected] ~]# tar xf libiconv-1.14.tar.gz [[email protected] ~]# CD Libiconv-1.14[[em AIL protected] libiconv-1.14]#/configure--prefix=/usr/local/libiconv [[email protected] libiconv-1.14]# make && Amp Make install
Install PHP
[[email protected] ~]# tar xf php-5.4.29.tar.gz[[email protected] ~]# cd php-5.4.29[[email protected] php-5.4.29]# ./configure > --prefix=/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-native-ttf > --with-curl > --with-xsl > --enable-ftp > --with-libxml-dir# Start compiling files Configure: wArning: unrecognized options: --enable-zend-multibytechecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin /grep -echecking for a sed that 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 are cross compiling... nochecking for suffix of object files... ochecking whether we are 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 understands -c and -o together... yeschecking how to run The c preprocessor... cc -echecking for ansi c header files ... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking 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 is safe to define __extensions__... yeschecking whether ln -s works... yeschecking for system library directory... libchecking whether to enable runpaths... yeschecking if compiler Supports -r... nochecking if compiler supports -wl,-rpath,... yeschecking for gawk... gawkchecking for 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 will need re2c 0.13.4 or later if you want to regenerate php parsers.checking whether to enable computed goto gcc extension with re2c... nochecking whether to force non-pic code 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... configure: error: you have enabled&nBsp Apache 1.3 support while your server is apache 2. please use the appropriate switch --with-apxs2# here prompts us to recompile with the--WITH-APXS2 parameter # to modify the parameters [[email protected] php-5.4.29]# ./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 > --enable-sockets > --enable-zend-multibyte \ #该参数已被废弃, remove and recompile > --enable-soap > --enable-mbstring > --enable-static > -- Enable-gd-native-ttf > --with-curl > --with-xsl > --enable-ftp > --with-libxml-dir[[ email protected] php-5.4.29]# make && make install[[email protected ] php-5.4.29]# ln -s /usr/local/php-5.4.39 /usr/local/php[[email protected] php-5.4.29]# cp php.ini-production /usr/local/php/lib/php.ini
This article is from the "ly36843" blog, please be sure to keep this source http://ly36843.blog.51cto.com/3120113/1643828
Compiling and installing php-5.4.29