phpize reports "Cannot find config.m4"

The phpize command is meant to be run at the top level of an extension source dir (this source dir should contain a file name config.m4).

See http://php.net/manual/en/install.pecl.phpize.php for more information.


My problem was that I was trying to execute the command just to see if I had it installed.

Trying to execute the command alone gives you that error, only use it inside the directory (most likely you downloaded) that contains the extension that you're trying to install.

Here some instructions to install Xdebug for php7.2 for example.

Take special care in step 3 and 4, first you change dir to the unpacked downloaded extension and then you run phpize.

Xdebug install instructions


In plain English, it means you're running the command from the wrong directory. You need to be in the directory that contains the source for the extension you're trying to install.

For example, if you're trying to install mcrypt, like I was when I came across this stack overflow page, you need to be in php-5.6.24/ext/mcrypt and then run the command.