Loading PHP extensions by name

Print
Read : 21,149 times
(0 votes, average 0 out of 5)



!!! Feature implemented in PHP 7.2.0 !!!

Today, PHP extensions are loaded using their file names. Unfortunately, this filename depends on the operating system. So, when they want to activate an extension, newcomers are confused about the exact directive they must add to the php.ini file. The php.ini comments are also very confusing, using the word 'extension' as a synonym for 'file suffix' and providing examples using the windows syntax only.

Fortunately, the rule to derive the file name from the extension name is known and simple :

{ppc:code}php_<extension-name>.dll{/}

{ppc:code}<extension-name>.<PHP_SHLIB_SUFFIX>{/}

where <PHP_SHLIB_SUFFIX> is a constant provided by the PHP core.

So, we have everything we need to allow users load their extensions using the extension name only, making it much easier for newcomers and non-specialists.

I propose to keep the same syntax :

{ppc:code}extension=<string>{/}

For backwards compatibility, the logic will be :

This change will also apply to Zend extensions ('zend_extension=' directive) and to the dl() function.

 
Joomla SEO powered by JoomSEF