您的足迹:首页 > linux知识 >centos下PHP编译安装常见错误

centos下PHP编译安装常见错误

安装PHP前,为避免一些错误,可以在编译前批量安装如下软件:
yum install libjpeg libjpeg-devel libxslt-devel? libxml2 libxml2-devel openssl-devel openssl-perl curl curl-devel libpng libpng-devel freetype freetype-devel -y

php安装:
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mcrypt \
--with-mcrypt \
--enable-mysqlnd --with-gd \
--with-iconv=/usr/local/libiconv \
--with-zlib \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir \
--with-mysqli \
--enable-embedded-mysqli  \
--with-pdo-mysql

报错1: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
报错2:configure: error: Please reinstall the libcurl distribution -
??? easy.h should be in /include/curl/
基本上确定是丢失了什么包所致,上网搜索得到需要事先安装的依赖包。
# RetHat CentOS or Fedora 使用下面安装命令
yum install curl curl-devel
# Debian or Ubuntu使用下面的安装命令
apt-get install curl
apt-get install libcurl4-gnutls-dev
错误3:configure: error: jpeglib.h not found.
解决方案如下:
[root@cac3 php-5.6.22]# rpm -qa | grep libjpeg
libjpeg-turbo-1.2.90-5.el7.x86_64
[root@cac3 php-5.6.22]# yum -y install libjpeg-devel
错误4
If configure fails try --with-vpx-dir=
If configure fails try --with-jpeg-dir=
configure: error: png.h not found.
经查资料说是libpng,devel包没安装,
执行下面两条命令即可解决
yum install libpng
yum install libpng-devel
然后重新编译安装就行了? ?
Configure: error: freetype.h not found.的解决办法
CentOS
yum install freetype-devel

错误5:configure: error: Please reinstall the iconv library.
源码安装 libiconv
源码安装libiconv,软件自行下载即可
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make & make install

错误6:configure: error: Cannot find OpenSSL's
yum install openssl-devel? openssl-perl? -y
错误7:configure: error: mcrypt.h not found. Please reinstall libmcrypt
yum install libmcrypt libmcrypt-devel mcrypt mhash(懒人安装)
源码安装(有些版本问题):
#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install 说明:libmcript默认安装在/usr/local

安装mhash
#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make
#make install

安装mcrypt
#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib ./configure //注意路径
#make
#make install

安装redis,mongo扩展
安装redis,mongo扩展:http://alisa365.com/linux/90.html
php安装protobuf 扩展以及安装protobuf-2.6.1软件扩展:http://alisa365.com/knowledge/109.html
启动php

错误8:报错make: *** [php_mongo.lo] Error 1 (
针对php7,网上很多教程是安装mongo.so扩展的,这是个比较旧的扩展,我的mongodb是3.2,PHP7.0,centos 7安装mongo.so扩展,make总是报错)
后来在https://stackoverflow.com/questions/40144519/make-php-mongo-lo-error-1?才知道是要安装mongod.so;所以版本比较高的要下载mongod的扩展包来安装;

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)