CentOS 源码安装PHP

1、下载PHP源码  http://www.php.net/

2、解压缩并且进入解压缩后的文件目录下

3、./configure --prefix=/data/apps/php --with-config-file-path=/data/apps/php/etc --with-apxs2=/data/apps/apache/bin/apxs --disable-ipv6 --with-curl --with-gd --with-mysql=/data/apps/mysql --with-mysqli=/data/apps/mysql/bin/mysql_config --with-pdo-mysql=/data/apps/mysql --enable-soap --enable-sockets --with-pear=/data/apps/php/pear --with-png-dir --with-libxml-dir --with-jpeg-dir --enable-mbstring --enable-zip --with-zlib --enable-gd-native-ttf --with-freetype-dir=/usr --with-openssl

4、make;make install


遇到问题:

1、configure: error: xml2-config not found. Please check your libxml2 installation(参看:http://blog.csdn.net/anljf/article/details/6981247

安装php时的报错

checking libxml2 install dir... no
checking for xml2-config path... 
configure: error: xml2-config not found. Please check your libxml2 installation.


检查是否安装了libxm包

[root@XKWB3403 php-5.3.8]# rpm -qa |grep  libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12

 

重新安装libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y

 

安装完之后查找xml2-config文件是否存在

[root@XKWB3403 php-5.3.8]# find / -name "xml2-config"
/usr/bin/xml2-config

 

如果存在的话重新安装php

[root@XKWB3403 php-5.3.8]# ./configure

 

安装成功的标志是

 

之后再进行编译

make && make install


参看http://www.cnblogs.com/z-ping/archive/2012/06/18/2553929.html

2、configure: error: Cannot find OpenSSL's <evp.h>

解决办法:yum  install  openssl.x86_64 openssl-devel.x86_64 -y

3、configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/

解决办法:yum install libcurl.x86_64 libcurl-devel.x86_64 -y


4、configure: error: libjpeg.(a|so) not found.

解决办法:yum install libjpeg-devel -y;  ln -s /usr/lib64/libpng.so /usr/lib/

configure: error: libpng.(a|so) not found.

解决办法:yum install libpng libpng-devel -y; ln -s /usr/lib64/libpng.so /usr/lib/
configure: error: freetype.h not found.

解决办法:yum install freetype-devel


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值