phpize 在 /usr/include/php 中找不到 PHP 头文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20827704/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
phpize Can't find PHP headers in /usr/include/php
提问by Matical
stack: PHP 5.4.23, php-fpm, nginx 1.4.x, centos 6.5
堆栈:PHP 5.4.23、php-fpm、nginx 1.4.x、centos 6.5
I was trying to install xdebug, had to run phpize command.
我试图安装 xdebug,不得不运行 phpize 命令。
I have php5-devl already installed and pecl command works
我已经安装了 php5-devl 并且 pecl 命令有效
When I ran the command, it gave me the following error output:
当我运行命令时,它给了我以下错误输出:
# phpize
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
How to fix this error?
如何修复此错误?
回答by Harikrishnan
I think you have not installed php-pear. I am not seeing it in that link.
我想你还没有安装php-pear。我没有在那个链接中看到它。
You can do it by yum install php-pear
你可以通过 yum install php-pear
Info
信息
You can install xdebug also using these steps
您也可以使用这些步骤安装 xdebug
1) Install PHP's devel package for PHP commands execution
1) 安装 PHP 的 devel 包来执行 PHP 命令
yum install php-devel
Make sure you also have php-pear package installed
确保您还安装了 php-pear 包
yum install php-pear
2) Install GCC and GCC C++ compilers to compile Xdebug extension yourself.
2)安装GCC和GCC C++编译器,自己编译Xdebug扩展。
yum install gcc gcc-c++ autoconf automake
yum install gcc gcc-c++ autoconf automake
3) Compile Xdebug
3)编译Xdebug
pecl install Xdebug
pecl install Xdebug
4) Find the php.ini file using
4) 使用找到 php.ini 文件
`locate php.ini`
And add the following line
并添加以下行
[xdebug]
zend_extension="/usr/lib64/php/modules/xdebug.so"
xdebug.remote_enable = 1
5) Restart Apache
service httpd restart
5)重启Apache
service httpd restart
6) Test if it works – create test.php with the following code
6) 测试是否有效 – 使用以下代码创建 test.php
<?php phpinfo(); ?>
回答by Suraj
The problem got solved by the PHP version that is used in the system.
该问题通过系统中使用的PHP版本解决。
My PHP Version was 5.6
我的 PHP 版本是 5.6
So by running the following command I solved the problem
所以通过运行以下命令我解决了这个问题
yum install php56-devel
Where "56" is your version of PHP.
其中“56”是您的 PHP 版本。
回答by Mimo
If you're on PHP 7 such as in my case just installing php-develwon't solve your problems, but you'll need to install some additional packages:
如果您使用的是 PHP 7,例如在我的情况下,仅安装php-devel并不能解决您的问题,但您需要安装一些额外的软件包:
yum install php-devel pcre-devel gcc make
yum install php-devel pcre-devel gcc make
And then you'll be able to follow Harikrishnan steps to get xdebug working (if not yet configured).
然后你就可以按照 Harikrishnan 的步骤来让 xdebug 工作(如果还没有配置)。
回答by Sergii Smirnov
My problem hasn't been solved using
我的问题没有解决使用
yum install php-devel
But this helped me to solve the problem:
但这帮助我解决了问题:
yum --enablerepo=remi,remi-php55 install php55-php-devel

