How to compile custom PHP extensions?
- PHP Selector
- PHP 5.X
- PHP 7.X
If you have decided that you want to build it on your own, you would need to build it for each and every supported version of PHP that you have installed. The module installation process is a bit different from the standard - you would need to use the version of the phpize and php-config binaries that come with a particular Alt-PHP version.
The full process for PHP 5.X and 7.X looks as follows:
Download and unpack the extension, and place it into its directory
- Execute our version of the phpize if necessary
- Execute configure with our binary:
- Make the .so file
- Copy it to the modules directory (on 32-bit server, use /usr/lib/php/modules)
cp -rp modules/*.so /opt/alt/phpXX/usr/lib64/php/modules/
- Add ini file for the module to the
- Register new Alt-PHP version with:
$ cagefsctl --setup-cl-selector