KNOWNHOST WIKI

User Tools

Site Tools


control-panels:misc:why-does-cagefs-prevents-installed-php-module-from-being-loaded

CageFS Prevents Installed PHP Module From Being Loaded


If you are using CageFS, you may find that your sites display errors about missing modules when the modules in fact are not missing and have just been installed.

In a recent case, Bcmath was not being detected when loading the site via the browser, but Bcmath showed as enabled when checking using the following command:

php -m | grep -i bcmath 

I tested with the following PHP script further:

<?php
if(extension_loaded('bcmath')) {
 echo("<html><body><p>Yay! BCMath is loaded!</p></body></html>");
} else {
 echo("<html><body><p>BCMath is not loaded.</p></body></html>");
}
?>

Running the script manually via the browser would yield "BCMath is not loaded." but running the script manually would yield "Yay! BCMath is loaded!":

[root@host ]# php extensiontest.php 
<html><body><p>Yay! BCMath is loaded!</p></body></html>[root@restaurantjobs public_html]# 
[root@host ]#

With CageFS, each user has a separate caged command binary folder. Thus, any new RPM package installed must be added to the CageFS of the users who need to execute them.

I added the package to CageFS with the command:

cagefsctl --addrpm ea-php53-php-bcmath

I then forced the users' CageFS configurations to update like so:

cagefsctl --force-update

The error was no longer shown in the browser. If you were to encounter this error, you could use a phpinfo page to confirm that the module is loaded after making the changes to CageFS.

:)

control-panels/misc/why-does-cagefs-prevents-installed-php-module-from-being-loaded.txt · Last modified: 2019/09/11 07:00 by Karson N.