• 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
    
  • 相关阅读:
    vscode如何将less编译到指定css目录中
    md文档的书写《二》
    关于页面scroolTop的获取
    git学习 c的某位老哥的,(侵删)
    学习git使用网址
    git,github,gitlab,码云的区别
    Git的基本使用
    php_review_day1
    shell脚本编程基础-构建基本脚本
    Linux基本命令
  • 原文地址:https://www.cnblogs.com/niuben/p/15497867.html
Copyright © 2020-2023  润新知