您的位置:首页 > 编程语言 > PHP开发

PHP安装编译教程

2016-01-17 21:56 686 查看
下载php:

#wget http://cn2.php.net/distributions/php-5.6.15.tar.gz
[rot@localhost httpd-2.2.16]# cd /usr/local/src
[root@localhost src]# wget http://am1.php.net/distributions/php-5.3.27.tar.gz 解压:
[root@localhost src]# tar zxf php-5.3.27.tar.gz
配置编译参数:

[root@localhost src]# cd php-5.3.27
[root@localhost php-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-config not found. Please check your libxml2 installation.
解决办法是:

yum install -y libxml2-devel
还有错误:

configure: error: Cannot find OpenSSL's <evp.h>
解决办法是:

yum install -y openssl openssl-devel
错误:
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
解决办法:

yum install -y bzip2 bzip2-devel
错误:

configure: error: png.h not found.
解决办法:

yum install -y libpng libpng-devel
错误:

configure: error: freetype.h not found.
解决办法:

yum install -y freetype freetype-devel
错误:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法:

rpm -ivh "http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm"
yum install -y libmcrypt-devel
因为centos6.x 默认的yum源没有libmcrypt-devel 这个包,只能借助第三方yum源。

configure: error: jpeglib.h not found.
root@deb:~/software/php-5.4.5#
环境:debian6.0.5 php5.4.5

解决之道 安装libjpeg

yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y

在yum这些包的时候,再次执行./configure的时候,再次出错。
然后,又yum一遍,提示出No package libjpeg-devel.x86_64,在yum库中没有找到这个包。
可以利用yum -y update命令更新yum库,更新完成以后,可以再次yum install,如果这一步成功,皆大欢喜。
如果依旧不可以,使用下一种方法,利用yum search 包名(例libjpeg-devel.x86_64可以写成libjpeg),可以搜出一些,可以找到相应其他的包
编译:

[root@localhost php-5.3.27]# make
安装:

[root@localhost php-5.3.27]# make install
拷贝配置文件:

[root@localhost php-5.3.27]# cp php.ini-production /usr/local/php/etc/php.ini

附件:http://down.51cto.com/data/2367302
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql local 编译教程