phpize stops with Cannot find config.m4
Cannot find config.m4Short 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.
Fix it fast
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.m42Match what you see, then jump to its fix
- 1
ls config.m4 says no such filephpize was run outside the extension's source directoryFix - 2
you 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
phpize: command not foundphpize itself is missing or comes from a package without the development filesFix
- 1
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.m42Fix
Go into the folder that contains config.m4 and run the steps from there.
cd /path/to/extname
phpize
./configure
make
sudo make install3Verify
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 extnameConfirmed by php.net
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.m42Fix
Install PIE and let it fetch and build the extension, instead of running phpize yourself.
pie install vendor/package-name3Verify
The extension shows in the module list.
php -mConfirmed by github.com
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 phpize2Fix
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 phpize3Verify
phpize is found.
phpize --helpConfirmed by php.net
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
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack 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 fixBack 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 fixBack end
CodeIgniter 3 stops with "Your system folder path does not appear to be set correctly"
503 Service Unavailable
CodeIgniter 3's front controller resolves $system_path and then checks that the result is a directory.
3 causes, each with a fix