下载php:

#wgethttp://cn2.php.net/distributions/php-5.6.15.tar.gz

[rot@localhosthttpd-2.2.16]#cd/usr/local/src

[root@localhostsrc]#wgethttp://am1.php.net/distributions/php-5.3.27.tar.gz

解压:

[root@localhostsrc]#tarzxfphp-5.3.27.tar.gz

配置编译参数:

[root@localhostsrc]#cdphp-5.3.27

[root@localhostphp-5.3.27]#./configure\

--prefix=/usr/local/php\

--with-apxs2=/usr/local/apache2/bin/apxs\

--with-config-file-path=/usr/local/php/etc\

--with-mysql=/usr/local/mysql\

--with-libxml-dir\

--with-gd\

--with-jpeg-dir\

--with-png-dir\

--with-freetype-dir\

--with-iconv-dir\

--with-zlib-dir\

--with-bz2\

--with-openssl\

--with-mcrypt\

--enable-soap\

--enable-gd-native-ttf\

--enable-mbstring\

--enable-sockets\

--enable-exif\

--disable-ipv6

在这一步,阿铭遇到如下错误:

configure:error:xml2-confignotfound.Pleasecheckyourlibxml2installation.

解决办法是:

yuminstall-ylibxml2-devel

还有错误:

configure:error:CannotfindOpenSSL's<evp.h>

解决办法是:

yuminstall-yopensslopenssl-devel

错误:

checkingforBZip2indefaultpath...notfound

configure:error:PleasereinstalltheBZip2distribution

解决办法:

yuminstall-ybzip2bzip2-devel

错误:

configure:error:png.hnotfound.

解决办法:

yuminstall-ylibpnglibpng-devel

错误:

configure:error:freetype.hnotfound.

解决办法:

yuminstall-yfreetypefreetype-devel

错误:

configure:error:mcrypt.hnotfound.Pleasereinstalllibmcrypt.

解决办法:

rpm-ivh"http://www.aminglinux.com/bbs/data/p_w_upload/forum/month_1211/epel-release-6-7.noarch.rpm"

yuminstall-ylibmcrypt-devel

因为centos6.x默认的yum源没有libmcrypt-devel这个包,只能借助第三方yum源。

configure:error:jpeglib.hnotfound.

root@deb:~/software/php-5.4.5#

环境:debian6.0.5php5.4.5

解决之道安装libjpeg


yuminstalllibjpeg.x86_64libpng.x86_64freetype.x86_64libjpeg-devel.x86_64libpng-devel.x86_64freetype-devel.x86_64-y

在yum这些包的时候,再次执行./configure的时候,再次出错。

然后,又yum一遍,提示出Nopackagelibjpeg-devel.x86_64,在yum库中没有找到这个包。

可以利用yum-yupdate命令更新yum库,更新完成以后,可以再次yuminstall,如果这一步成功,皆大欢喜。

如果依旧不可以,使用下一种方法,利用yumsearch包名(例libjpeg-devel.x86_64可以写成libjpeg),可以搜出一些,可以找到相应其他的包

编译:

[root@localhostphp-5.3.27]#make

安装:

[root@localhostphp-5.3.27]#makeinstall

拷贝配置文件:

[root@localhostphp-5.3.27]#cpphp.ini-production/usr/local/php/etc/php.ini


附件:http://down.51cto.com/data/2367302