Can't find PHP headers in /usr/include/php The php-devel package is required for use of this command.

报错

phpize 编译扩展时,报错:Can't find PHP headers in /usr/include/php The php-devel package is required for use of this command.

/usr/include/php 中找不到PHP头文件,使用此命令需要 php-devel 包。

解决办法

phpize 是用来扩展 php 扩展模块的,通过 phpize 可以建立 php 的外挂模块,phpize 是属于 php-devel 的内容,所以只要运行 yum install php-devel 就行了

复制代码
yum install php-devel

接下来就会安装上 php-devel

复制代码
Installed:
  pcre-cpp-8.42-4.el8.x86_64                                 pcre-devel-8.42-4.el8.x86_64     
  pcre-utf16-8.42-4.el8.x86_64                               pcre-utf32-8.42-4.el8.x86_64     
  php-devel-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64     

Complete!

这时,如果使用 phpize 编译扩展出现 error:

复制代码
Error: php72w-common confiicts with php-common-xxx.xx
You cold try using --skip-broken to work around the problem
You cold try running:rpm -Va --nofiles --nodigest

这说明仓库中默认的phpize与 PHP 版本不一致,我们可以看下 php-devel的版本,然后重新安装 phpize

复制代码
yum info php-devel
Repository epel is listed more than once in the configuration
Last metadata expiration check: 1:46:46 ago on Tue 02 Nov 2021 09:08:48 AM CST.
Installed Packages
Name         : php-devel
Version      : 7.2.24
Release      : 1.module_el8.2.0+313+b04d0a66
Architecture : x86_64
Size         : 5.3 M
Source       : php-7.2.24-1.module_el8.2.0+313+b04d0a66.src.rpm
Repository   : @System
From repo    : AppStream
Summary      : Files needed for building PHP extensions
URL          : http://www.php.net/
License      : PHP and Zend and BSD and MIT and ASL 1.0
Description  : The php-devel package contains the files needed for building PHP
             : extensions. If you need to compile your own PHP extensions, you will
             : need to install this package.

安装与当前版本一致的 php-devel就可以了,例如:

复制代码
yum install php72w-devel
posted @   牛奔  阅读(661)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
历史上的今天:
2019-11-02 nvm —— Node版本管理工具
点击右上角即可分享
微信分享提示