Resolving the autoconf Missing Error in XAMPP on CentOS
When compiling PHP extensions, you will encounter a specific error message that stops the build process dead in its tracks: Cannot find autoconf. Please check your autoconf installation. This often happens when developers attempt to install modules like memcached using phpize within the XAMPP environment on CentOS. The error is explicit about the missing dependency, but understanding how to address it requires a clear grasp of why autoconf is necessary and exactly where the breakage occurs in the XAMPP stack.
The log output from your terminal provides immediate context:
# /opt/lampp/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
The tool phpize is designed to generate the standard configuration files (config.m4, Makefile) needed to compile PHP modules. To function, phpize relies heavily on a chain of build utilities, specifically autoconf, automake, and libtool. When you run /opt/lampp/bin/phpize, the script executes a series of checks to ensure these tools are available in your execution path. If autoconf is not found, the script halts immediately before attempting any configuration logic.
The root cause on CentOS systems running XAMPP is almost always that the development tools required for compilation are either not installed or not located in the system's default search paths. Unlike a standard Linux distribution where yum install gcc make autoconf is straightforward, XAMPP comes bundled with its own PHP binary at /opt/lampp/bin/phpize. While this bundled phpize works well for building modules against the bundled PHP source, it does not magically provide the C compiler toolchain or the autotools suite required to process those source files.
To resolve this, you must install the missing dependencies directly on the CentOS operating system. The standard approach is to use yum (or dnf) to install the autoconf, automake, and gcc packages. This ensures that the version of autoconf installed via the package manager matches the expectations of the build environment, avoiding potential ABI incompatibilities between the OS-provided tools and the bundled XAMPP binaries.
Run the following command in your terminal:
sudo yum install -y autoconf automake libtool gcc make curl bzip2 unzip zlib-devel openssl-devel php-devel
Note that installing php-devel is often recommended even when using the bundled PHP, as it provides header files and libraries that might be expected by certain extension build scripts. Once these packages are installed, verify their availability:
which autoconf
which gcc
If these commands return valid paths (e.g., /usr/bin/autoconf), you can rerun your original phpize command. The script should now proceed past the initial check and begin configuring for the PHP API version 20131106.
There is a subtle but important distinction to keep in mind regarding the XAMPP environment. While some online tutorials suggest installing a global PHP installation (via EPEL or source) and linking it to XAMPP, this approach introduces significant complexity, particularly when managing multiple versions of PHP or when dealing with system-level SELinux policies on CentOS. Sticking to the native yum package manager for build tools is generally safer and more maintainable than mixing system libraries with the bundled XAMPP stack unless you have a specific requirement to do otherwise.
After installing the dependencies, navigate to your extension directory (e.g., ext/memcached) and retry:
/opt/lampp/bin/phpize
make
sudo make install
Ensure that the newly compiled shared object is placed in the correct extension_dir specified by your XAMPP PHP configuration. If the build succeeds without errors, you can restart the Apache service within XAMPP to load the new module and verify functionality using phpinfo().
