phpize
Prepare PHP extension builds
TLDR
Prepare the PHP extension in the current directory for compiling
Delete files previously created by phpize
SYNOPSIS
phpize
DESCRIPTION
phpize prepares a PHP extension build environment. It's used when you want to compile a PHP extension from source, especially when the extension isn't included in your PHP distribution or you need a custom version. It examines your current PHP setup (PHP binary, include files, etc.) and generates the necessary configure script for building the extension against that specific PHP version. This ensures compatibility between the extension and your PHP environment.
phpize is typically run from within the extension's source directory after extracting the source code from a tarball or cloning it from a repository. It creates a configure script, which you then execute to customize the build process and resolve dependencies. After configuration, you would usually run make to compile the extension and make install to install it into your PHP extensions directory. The user can then enable the extension by adding it to your php.ini configuration file.
CAVEATS
Requires the php-dev or php-devel package to be installed which contains the header files needed for compiling PHP extensions. Using the wrong phpize version for the target php version can lead to errors or unexpected behavior.
TYPICAL USAGE
The most common use case involves downloading the source code of the extension, extracting it to a directory, navigating into that directory, and running phpize. After this, you would execute ./configure, make, and finally make install.
TROUBLESHOOTING
If you encounter errors related to missing header files, make sure the php-dev package is installed. If you get errors about incorrect PHP versions, ensure you are using the phpize command associated with the correct PHP version (you might have multiple PHP versions installed). Examine the output of phpize and ./configure for specific error messages.
HISTORY
phpize has been part of PHP's build system since the early days of PHP extensions. It evolved alongside PHP to support various extension development methodologies. It greatly simplified the process of compiling and installing extensions, which previously required manual manipulation of makefiles and include paths.
SEE ALSO
php-config(1), pecl(1)