Php – Alternatives to dl() in PHP

PHPrhel6yum

We have a third-party package that requires the use of the PHP dl() function to load a binary extension. This function has been deprecated and removed as of PHP 5.3, so we're looking for a way to get this to work – possibly by downgrading to PHP 5.2.

I seem to be having a really rough time with trying to get a PHP 5.3 installation downgraded to 5.2. I have tried using the yum downgrade util, but that fails miserably.

Would anyone know how to do this that doesn't involve compiling from source as I am not too eager to have to try to satisfy a boat load of dependencies manually?

Alternatively, is there another way we can make this third-party package work without requiring dl()?

Best Answer

Downgrading to an unsupported PHP version is likely to be (no surprise) unsupported.
Compiling from source, or finding someone who has packaged an RPM, are pretty much your only two options.


BIG IMPORTANT SECURITY NOTE

You probably do not need to use dl().
You should never need to use dl().
Despite what you may have been told, alternatives do exist to using dl().

You should be using the php.ini directive extension instead of dl().

If your third-party software is so poorly written that you can't load the extensions securely (using php.ini's extension directive) you need to have a serious conversation with your vendor - they are asking you to expose your entire system to undue risk, both through using dl() and by forcing you to run an unsupported PHP version in order to use their product.