当前位置: 首页 > 编程文章 >

CentOS编译PHP5常见错误及yum解决方法

CentOS编译PHP5常见错误及yum解决方法

作者:叶川时间:2025-02-02 11:07:59浏览:235

在CentOS系统中编译安装PHP5时,常因缺少开发库导致configure失败。本文汇总了BZip2、cURL、JPEG、PNG、Freetype、GMP、LDAP、MySQL、PostgreSQL、SQLite等常见模块的报错信息,并提供对应的yum install命令以快速修复依赖缺失问题。

本文目录收起

CentOS编译PHP5常见错误及解决方法

在CentOS环境下编译安装PHP5期间,经常会出现各类配置检查失败的提示。绝大多数情况下,只需通过yum工具安装对应的开发库即可解决。下文列举了具体的错误现象与修复方案:

复制代码 代码如下: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.

重新配置PHP并添加参数:--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后端解密

微信小程序通过getPhoneNumber()组件获取用户绑定手机时,返回的是加密密文。需先调用wx.login获取code,再经服务器换取session_key,最后将encryptedData、iv和session_key传至后端进行AES解密。本文以PHP为例,详解从前端授权触发到后端解密获取明文的完整链路及常见异常处理。

下一篇
MySQL server has gone away 错误排查与解决方案

MySQL 报错 'ERROR : (2006, 'MySQL server has gone away')' 表示客户端与服务端连接中断。常见原因包括 SQL 语句或 BLOB 数据过大超过 max_allowed_packet 限制、长连接空闲超时被服务端关闭,以及服务宕机或进程被 Kill。通过调整 my.cnf 中的 wait_timeout 和 max_allowed_packet 参数,或在代码中实现连接状态检测与重连机制,可有效解决该问题。

相关文章

更多
CentOS 6.4 环境下 SVN 服务安装、配置及端口修改指南

本文介绍在 CentOS 6.4 系统中部署 Subversion (SVN) 服务器的完整流程。内容涵盖从检查并卸载旧版本、使用 yum 安装 SVN、创建仓库目录,到详细配置 authz、passwd 和 svnserve.conf 文件以设置用户权限。此外,还演示了如何启动服务、验证监听端口,并将默认端口 3690 修改为 20016,最后通过 TortoiseSVN 客户端连接测试确保配置生效。

2025.12.15 995
CentOS环境下Docker安装与基础概念解析

Docker作为容器引擎,通过镜像、容器和仓库三大核心概念实现应用的高效交付与部署。本文以CentOS系统为例,详细演示如何配置官方YUM仓库并安装Docker Engine-Community及containerd组件。完成安装后,可通过启动Docker服务并运行hello-world镜像来验证环境是否正常工作,为后续MySQL、Nginx等服务的容器化部署奠定基础。

2026.01.06 977
CentOS定制RPM包与自建YUM仓库完整指南

本文介绍在CentOS系统中利用FPM工具将源码编译的Nginx打包为RPM,并通过Createrepo搭建本地YUM仓库的方法。内容涵盖保留缓存、安装依赖、参数详解、仓库初始化及客户端配置,同时提供常见依赖错误排查和公网源同步方案,旨在优化内网软件分发效率并节省带宽。

2026.10.04 975
在 CentOS/RHEL 中配置 VLAN 标记以太网卡

本文介绍如何在 CentOS 和 RHEL 系统中通过 VLAN 标记接口,在同一物理网卡上分配多个不同 VLAN 的 IP 地址。操作涉及加载 8021q 内核模块、使用 ip 命令创建临时接口并分配 IP,以及编写 ifcfg 配置文件以确保重启后配置持久化生效。

2026.07.17 974
PHP5常用函数速查:从字符串处理到XML解析

本文整理了PHP5版本中常用的核心函数,涵盖字符串操作、时间控制、文件处理及数据编码等多个领域。重点介绍了如substr、str_replace等字符串函数的用法,以及xml_parser_create、zip_open等用于处理XML和ZIP文件的机制,帮助开发者快速定位所需功能。

2026.03.25 968
Windows下PHP5与Apache的安装配置指南

本文介绍在Windows环境下安装和配置Apache服务器与PHP5的方法。首先从官方渠道下载Apache安装程序和PHP ZIP包,解压至C盘根目录并命名为php。接着将php5ts.dll放入系统目录,复制php.ini-recommended为php.ini至Windows目录。最后通过编辑httpd.conf,选择以CGI或模块方式加载PHP,完成协同工作设置并进行本地测试。

2025.04.17 961

专题推荐

更多
PHP 类与对象定义及继承

先看类声明、对象实例与属性访问。理解对象的创建和销毁后,再读继承、方法重载和关键字对照。已有代码遇到继承行为差异时,可进一步查看 final 方法与反射实例。

PHP 定时任务配置与运行

先确定任务运行间隔以及是否允许重叠。固定时间触发先看 Cron 案例,框架内和常驻服务再读对应示例。

Yii2 队列配置与常驻运行

先用一个最小任务跑通入队和消费,再检查 Web 与 Console 是否加载了相同的队列配置。确认命令能手动运行后再配置 Supervisor,最后验证进程重启时的处理情况。

PHP Session 过期时间设置方法

浏览器关闭、服务端回收和业务规定的闲置超时,可能在不同时间发生。对照配置项与应用层时间戳的做法,检查会话何时仍可读、何时应要求重新登录。

PHP URL 编码和解码方法

URL 路径片段和查询参数对空格的处理方式不同。先比较 urlencode 与 rawurlencode,再沿解码过程核对中文、加号和百分号,检查地址是否被重复编码或提前解码。

在线工具箱

更多
键码查询
键码查询

按下键盘按键时查看浏览器记录的键名和事件信息。

.env 配置检查
.env 配置检查

本地检查 .env 键值语法、引号、重复键及空值,预览解析结果,辅助排查 PHP 和 Laravel 环境配置。

进制转换
进制转换

转换二进制、十进制、十六进制等数值表示,辅助程序调试与进制学习。

HTML 标签安全清理
HTML 标签安全清理

清理 HTML 片段中的标签或危险内容,辅助整理待展示的文本。

文件 Base64 转换
文件 Base64 转换

把文件转为 Base64 文本,也可将编码内容还原为文件,方便接口传输与调试。