WEB应用

php5编译安装常见错误和解决办法集锦

Jager · 11月22日 · 2015年 · 1077次已读

最近在给开发同事折腾开发测试环境,其中就有 php 的编译安装。由于每个人的需求不一致,所以也接触到了各种模块编译和集成,中间不乏各种编译依赖报错。

正好,搜了几次都是下面 2 篇文章内容,干脆就转到自己博客,以备后用,后续有相关内容再继续补充。php5编译安装常见错误和解决办法集锦

 

checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution

解决办法:yum install bzip2-devel

checking for cURL support… yes checking if we should use cURL for url streams… no checking for cURL in default path… not found configure: error: Please reinstall the libcurl distribution – easy.h should be in/include/curl/

解决办法: yum install curl-devel

 

checking for curl_multi_strerror in -lcurl… yes checking for QDBM support… no checking for GDBM support… no checking for NDBM support… no configure: error: DBA: Could not find necessary header file(s).

解决办法: yum install db4-devel

checking for fabsf… yes checking for floorf… yes configure: error: jpeglib.h not found.

解决办法: yum install libjpeg-devel

checking for fabsf… yes checking for floorf… yes checking for jpeg_read_header in -ljpeg… yes configure: error: png.h not found.

解决办法: yum install libpng-devel

checking for png_write_image in -lpng… yes If configure fails try –with-xpm-dir=

configure: error: freetype.h not found.

解决办法: Reconfigure your PHP with the following option. --with-xpm-dir=/usr

checking for png_write_image in -lpng… yes configure: error: libXpm.(a|so) not found.

解决办法: yum install libXpm-devel

checking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.h

解决办法: yum install gmp-devel

checking for utf8_mime2text signature… new checking for U8T_DECOMPOSE… configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

解决办法: yum install libc-client-devel

checking for LDAP support… yes, shared checking for LDAP Cyrus SASL support… yes configure: error: Cannot find ldap.h

解决办法: yum install openldap-devel

checking for mysql_set_character_set in -lmysqlclient… yes checking for mysql_stmt_next_result in -lmysqlclient… no checking for Oracle Database OCI8 support… no checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!

解决办法:  yum install unixODBC-devel

checking for PostgreSQL support for PDO… yes, shared checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

解决办法:  yum install postgresql-devel

checking for sqlite 3 support for PDO… yes, shared checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext checking for sqlite3 files in default path… not found configure: error: Please reinstall the sqlite3 distribution

解决办法:  yum install sqlite-devel

checking for utsname.domainname… yes checking for PSPELL support… yes configure: error: Cannot find pspell

解决办法: yum install aspell-devel

checking whether to enable UCD SNMP hack… yes checking for default_store.h… no

checking for kstat_read in -lkstat… no checking for snmp_parse_oid in -lsnmp… no checking for init_snmp in -lsnmp… no configure: error: SNMP sanity check failed. Please check config.log for more information.

解决办法: yum install net-snmp-devel

checking whether to enable XMLWriter support… yes, shared checking for xml2-config path… (cached) /usr/bin/xml2-config checking whether libxml build works… (cached) yes checking for XSL support… yes, shared configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

解决办法: yum install libxslt-devel

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

解决办法: yum install libxml2-devel

checking for PCRE headers location… configure: error: Could not find pcre.h in /usr

解决办法: yum install pcre-devel

configure: error: Cannot find MySQL header files under yes. Note that the MySQL client library is not bundled anymore!

解决办法: yum install mysql-devel

checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!

解决办法: yum install unixODBC-devel

checking for pg_config… not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

解决办法: yum install postgresql-devel

configure: error: Cannot find pspell

解决办法: yum install pspell-devel

configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.

解决办法: yum install net-snmp-devel

configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

解决办法: yum install libxslt-devel

以上摘自:php 源码编译常见错误解决方案|驴子博客

1、PHP 出现 segmentation fault 错误
现象:安装完成后出现的这个问题让我一顿网上狂搜,但都无济于事。在运行任何有关 PHP 的命令时都会返回 segmentation fault 的错误,比如:php -v 或 php -m 等。经过不断试错和排查 php.ini,最终发现是在安装完 Zend Guard Loader 之后出现的。
原因: Zend Guard Loader 的配置错误。
解决办法:将 extension = ZendGuardLoader.so 改为 zend_extension = ZendGuardLoader.so 即可。
最后,我将所有可选安装的配置都单独放到 /usr/local/php/php.d 下了,而不是一股脑放到 php.ini 中,这样便于出问题时排查。

2、ICU 相关错误
现象:Unable to detect ICU prefix or /usr//bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works
解决办法:yum install -y icu libicu libicu-devel
关于 ICU 的编译参数:./configure –with-icu-dir=/usr

3、bzip2 相关错误
现象:checking for BZip2 support… yes checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution
解决办法:yum install -y bzip2 bzip2-devel
关于 bzip2 的编译参数:./configure –with-bz2

4、gmp 相关错误
现象:checking for bind_textdomain_codeset in -lc… yes checking for GNU MP support… yes configure: error: Unable to locate gmp.h
解决办法:yum install -y gmp-devel
关于 gmp 的编译参数:./configure –with-gmp

5、readline 相关错误
现象:configure: error: Please reinstall libedit – I cannot find readline.h
解决办法:安装 Editline Library (libedit),官网:http://thrysoee.dk/editline/
下载最新版 libedit 编译安装即可。
关于 readline 的编译参数:./configure –with-readline

6、xsl 相关错误
现象:configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解决办法:yum install -y libxslt libxslt-devel libxml2 libxml2-devel
关于 xsl 的编译参数:./configure –with-xsl

7、pcre 相关错误
现象:checking for PCRE headers location… configure: error: Could not find pcre.h in /usr
解决办法:yum install -y pcre-devel
关于 pcre 的编译参数:./configure –with-pcre-dir
备注:在 CentOS 5.x 中,pcre 的最新版本为 6.6,版本过低会导致在编译 Apache 2.4.x 的时候出现错误。因此,建议编译安装 pcre 的最新版 8.35,替换低版本的 pcre。

以上摘自:PHP 编译过程中常见错误信息的解决方法 | 林家铺子

后续遇到 PHP 相关问题,也会继续更新到此文当中,以备后用。

10 条回应
  1. web前端技术 2015-11-23 · 10:31

    暂时还没有遇到这样的情况,先收藏了

  2. 产融贷p2p理财 2015-11-23 · 11:58

    不明觉厉的样子,牛!

  3. 香港云主机 2015-11-24 · 17:29

    像这些错误,在程序里或许迟早会遇到,先收藏着后头遇到就很好处理了

  4. 李阳博客 2015-11-24 · 18:08

    这会儿访问贵站发现经常会无法访问。

  5. 男生女生银版 2015-11-26 · 8:56

    好多图片挂了,留言板滑动提交不见了不能提交留言。

    • avatar
      Jager 2015-11-26 · 8:57

      换浏览器或清理缓存刷新即可。

  6. 呲牙网 2015-11-26 · 10:56

    先收藏了,免得以后遇到了不知道怎么办

  7. app制作 2015-11-27 · 14:55

    学习了哦

  8. 爆实惠 2015-11-27 · 23:13

    技术大牛啊,mark 备用

  9. 瑾瑜 2015-11-28 · 10:47

    有些图片的确不显示……