phpize Can't find PHP headers in /usr/include/php

Matical picture Matical · Dec 29, 2013 · Viewed 46.2k times · Source

stack: PHP 5.4.23, php-fpm, nginx 1.4.x, centos 6.5

I was trying to install xdebug, had to run phpize command.

I have php5-devl already installed and pecl command works

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?

Answer

Harikrishnan picture Harikrishnan · May 5, 2014

I think you have not installed php-pear . I am not seeing it in that link.

You can do it by yum install php-pear

Info

You can install xdebug also using these steps

1) Install PHP’s devel package for PHP commands execution

yum install php-devel

Make sure you also have php-pear package installed

yum install php-pear

2) Install GCC and GCC C++ compilers to compile Xdebug extension yourself.

yum install gcc gcc-c++ autoconf automake

3) Compile Xdebug

pecl install Xdebug

4) Find the php.ini file using

`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

6) Test if it works – create test.php with the following code

<?php phpinfo(); ?>