23

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?

Harikrishnan
  • 9,688
  • 11
  • 84
  • 127
Matical
  • 454
  • 1
  • 4
  • 19

4 Answers4

20

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(); ?>
Harikrishnan
  • 9,688
  • 11
  • 84
  • 127
9

The problem got solved by the PHP version that is used in the system.

My PHP Version was 5.6

So by running the following command I solved the problem

yum install php56-devel

Where "56" is your version of PHP.

Suraj
  • 443
  • 4
  • 11
1

If you're on PHP 7 such as in my case just installing php-devel won't solve your problems, but you'll need to install some additional packages:

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).

Mimo
  • 6,015
  • 6
  • 36
  • 46
  • 1
    Error: php70w-common conflicts with php-common-5.4.16-45.el7.x86_64 – Eddie May 21 '18 at 02:56
  • 1
    In fact if you read my answer starts with *if you're on PHP7* – Mimo May 22 '18 at 08:27
  • @Eddie This link solves the php70w-common conflict with php-common-5.4.16.el7.x86_64 https://linuxconfig.org/how-to-install-or-upgrade-to-php-7-on-centos-linux-server . Basically, install php7 in your centOS system enabling Remi and EPEL repos. – Giuseppe Dec 16 '19 at 01:24
0

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
Serhii Smirnov
  • 1,338
  • 1
  • 16
  • 24
  • 2
    If you use "remi" repository, you probably don't need to build any pecl extension, most are available in the repository ;) See the list on http://blog.remirepo.net/pages/PECL-extensions-RPM-status – Remi Collet Nov 30 '15 at 18:06