Customizing cPanel internal PHP for 11.36+

bytebeam

Registered
Sep 23, 2013
4
0
1
cPanel Access Level
Website Owner
From v 11.36 +, makecpphp is no longer supported, and cPanel advises to customize the related RPM (for v 11.40, its cpanel-php53.5.3.17-5.cp1136).

Our setup requires the bcmath extension. For the moment, we use a postupcp hook which executes the following:

- Backup of the /usr/local/cpanel/3rdparty/php/53/etc/php.ini
- Overwriting of /usr/local/cpanel/3rdparty/php/53/etc/php.ini with our custom php.ini
- Copy bcmath.so to /usr/local/cpanel/3rdparty/php/53/lib64/extensions/bcmath.so
- /usr/local/cpanel/bin/install_php_inis
- service cpanel restart

This method is rather inelegant and won't cope with changes to internal PHP versions, therefore we would also have to freeze the current PHP rpm.

I would be grateful if someone could suggest another way to automate internal PHP customizations where additional modules would always be included no matter the version.

As side note, is there any reason why the internal PHP version differs from the PHP version available with EasyApache ? I do understand that both PHP instances serve a different context and require each their own set of specific settings, but why maintain concurrently different versions of PHP instead of the same version running with a different config ?
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
From v 11.36 +, makecpphp is no longer supported, and cPanel advises to customize the related RPM (for v 11.40, its cpanel-php53.5.3.17-5.cp1136).

Our setup requires the bcmath extension. For the moment, we use a postupcp hook which executes the following:

- Backup of the /usr/local/cpanel/3rdparty/php/53/etc/php.ini
- Overwriting of /usr/local/cpanel/3rdparty/php/53/etc/php.ini with our custom php.ini
- Copy bcmath.so to /usr/local/cpanel/3rdparty/php/53/lib64/extensions/bcmath.so
- /usr/local/cpanel/bin/install_php_inis
- service cpanel restart

This method is rather inelegant and won't cope with changes to internal PHP versions, therefore we would also have to freeze the current PHP rpm.

I would be grateful if someone could suggest another way to automate internal PHP customizations where additional modules would always be included no matter the version.

As side note, is there any reason why the internal PHP version differs from the PHP version available with EasyApache ? I do understand that both PHP instances serve a different context and require each their own set of specific settings, but why maintain concurrently different versions of PHP instead of the same version running with a different config ?
I'll file a request to add bcmath to the internal PHP.