欢迎来到 一木浮生 的博客

人生三重境界:昨夜西风凋碧树,独上高楼,望尽天涯路。 衣带渐宽终不悔,为伊消得人憔悴。 众里寻他千百度,蓦然回首,那人却在灯火阑珊处。
扩大
缩小

PHP编译常见错误

一、PHP编译

  (一)、依赖环境

编译常用依赖包:

yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libxslt libxslt-devel

  (二)、编译参数

常用编译参数:

./configure \
--prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-ldap \
--with-gettext \
--with-iconv-dir \
--with-jpeg-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip \
--with-fpm-group=nginx \
--with-fpm-user=nginx

 执行编译

make -j 2 && make install

 

 

二、编译安装PHP常见错误

  (一)、错误一

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

解决方法:

yum -y install libxml2-devel

  (二)、错误二

checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution

解决方法:

yum install -y  bzip2-devel

  (三)、错误三

If configure fails try --with-vpx-dir=
configure: error: png.h not found.

解决方法:

yum -y install libpng-devel

  (四)、错误四

If configure fails try --with-xpm-dir=
configure: error: freetype.h not found.

解决方法:

yum -y install freetype-devel

  (五)、错误五

checking for specified location of the MySQL UNIX socket... no
configure: error: Cannot find MySQL header files under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!

解决方法:

yum -y install mysql
#没有安装mysql数据导致,安装mysql即可

  (六)、错误六

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方法:

#安装libmcrypt
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
tar -zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
mkdir -p /usr/local/libmcrytp
./configure prefix=/usr/local/libmcrytp/
make
make install

 

posted on 2018-07-25 14:28  一木浮生  阅读(260)  评论(0编辑  收藏  举报

导航