Issue
How to compile custom PHP extensions?
Environment
- PHP Selector
- cPanel
- PHP 5.X
- PHP 7.X
Solution
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:
./configure --with-php-config=/opt/alt/phpXX/usr/bin/php-config
- Make the .so file
make
- 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
/opt/alt/phpXX/etc/php.d.all
-
Register new Alt-PHP version with:
$ cagefsctl --setup-cl-selector
Useful links
Comments
0 comments
Please sign in to leave a comment.