Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

phpize stops with Cannot find config.m4

ErrorCannot find config.m4

Short answer

phpize prepares one extension for building, and it looks for that extension's config.m4 in the folder you run it in. If the file is missing, you are in the wrong directory, such as your home folder or the PHP source tree. Change into the extracted extension source and run phpize there, or install the extension with PIE instead.

  • Applies to PHP 8.3, PHP 8.4, macOS 15, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check that the folder you are in holds the extension's source, with config.m4 next to its C files.

    pwd
    ls config.m4
  2. 2Match what you see, then jump to its fix

    1. 1ls config.m4 says no such filephpize was run outside the extension's source directoryFix
    2. 2you are following an old PECL tutorial and the download is not an extension source folderYou do not need to compile the extension by handFix
    3. 3phpize: command not foundphpize itself is missing or comes from a package without the development filesFix

What does the error look like?

  • Cannot find config.m4

Cause 1 of 3

phpize was run outside the extension's source directory

1Check

The PHP manual's steps start with cd into the extension folder. Running phpize from your home folder, the downloaded archive's parent or a sub-folder gives this error.

pwd
find . -maxdepth 2 -name config.m4

2Fix

Go into the folder that contains config.m4 and run the steps from there.

cd /path/to/extname
phpize
./configure
make
sudo make install

3Verify

make install puts extname.so into the extensions directory. Add the extension line to php.ini and list the loaded modules.

# php.ini
extension=extname.so
php -m | grep extname

Confirmed by php.net

Did this fix it?

Cause 2 of 3

You do not need to compile the extension by hand

1Check

PECL is deprecated. The PHP manual says PHP Installer for Extensions (PIE) replaces it and is the recommended way to install extensions.

ls config.m4

2Fix

Install PIE and let it fetch and build the extension, instead of running phpize yourself.

pie install vendor/package-name

3Verify

The extension shows in the module list.

php -m

Confirmed by github.com

Did this fix it?

Cause 3 of 3

phpize itself is missing or comes from a package without the development files

1Check

Precompiled PHP packages often leave phpize out. The manual says to install the development version of the PHP package, which carries phpize and the header files.

command -v phpize

2Fix

Install the matching development package for your PHP (the -dev or -devel one), then run the build steps again.

# Install the -dev (Debian, Ubuntu) or -devel (RPM) package
# that matches the PHP version you run, then check:
command -v phpize

3Verify

phpize is found.

phpize --help

Confirmed by php.net

Did this fix it?

How do I stop it coming back?

  • Extract the extension archive and work inside its folder; keep that folder name in your notes.
  • Prefer PIE or the pecl tool to compile by hand.
  • Run phpize --help to see usage notes for your version.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

CodeIgniter 4 cannot write its cache files

CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/

CodeIgniter 4's file cache needs a cache directory that the web server can really write to.

2 causes, each with a fix

Back end

CodeIgniter 3 loads the model but the property is undefined

The model name you are loading is the name of a resource that is already being used: user

CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.