phpize
Prepare PHP extension builds
TLDR
Prepare the PHP extension in the current directory for compiling
Delete files previously created by phpize
SYNOPSIS
phpize [options]
PARAMETERS
--help
Displays a comprehensive help message for phpize usage.
--version
Shows the version information of the phpize utility.
--clean
Removes all files generated by a previous phpize run, such as configure, aclocal.m4, and Makefile.in.
DESCRIPTION
phpize is a utility script used to prepare the build environment for PHP extensions. When you have a PHP extension's source code (typically C files), it generates the necessary files, such as a configure script and Makefile.in, from a config.m4 file. This process is essential for compiling the extension into a loadable PHP module. It's the crucial first step in the standard build procedure for PHP extensions, ensuring the extension is built against the correct PHP version and configuration. It automates the generation of the build system, making extension compilation straightforward.
CAVEATS
phpize requires PHP development headers and tools like autoconf and automake to be installed on the system. It only prepares the build system; actual compilation of the extension requires subsequent steps: running the generated configure script and then make. It is specifically designed for PHP extensions.
<B>PECL INTEGRATION</B>
phpize is fundamental for manually compiling and installing PECL extensions. While PECL often automates the process, phpize is the underlying utility it uses to prepare the extension for building.
<B>TYPICAL BUILD WORKFLOW</B>
The typical workflow for compiling a PHP extension using phpize involves several steps:
1. Run phpize in the extension's source directory.
2. Execute the generated ./configure script, optionally with specific PHP installation paths (e.g., --with-php-config=/path/to/php-config).
3. Run make to compile the extension.
4. Run sudo make install to install the compiled module into PHP's extension directory.
HISTORY
phpize emerged as a vital component of the PHP build system to standardize the compilation of PHP extensions. Before its widespread adoption, building extensions could be more manual or inconsistent. Its introduction streamlined the process, providing a consistent, automated way to generate build scripts (like configure) from an extension's config.m4 file. This standardization greatly facilitated the distribution and installation of PHP extensions, particularly contributing to the ease of use of the PECL (PHP Extension Community Library) repository.