On 5/10/2016 9:01 PM, Lester Caine wrote: > The idea has been proposed before, but the addition of php_ for windows > installs has not been universally applied. Extensions like eAccelerator, > adodb and other third party extensions that did not form part of the > windows 'installation' files. Most of these have been killed off by the > restructuring of the core so it's probably less of a problem now than 5 > years ago! > > Another negative is the fact that most Linux installations do not use > entries in the php.ini file to enable extensions, preferring to manage > them via the package manager. THAT particular practice is something I > already copy back to the windows installs, using individual .ini files > for each extension, and stripping those extensions and settings from the > main php.ini. > > This is not simply a matter of adding another load mechanism to the mix, > so any rfc should perhaps bear in mind all the aspects of 'package > management' process? Certainly it's not quite as simple as assuming > windows extensions start php_ and end .dll ... >
Handling of the prefix is a no brainer. Just check for php_NAME.dll and
fallback to NAME.dll on Windows otherwise. If both fail error out.
The approach to split ini files does not work on CLI.
UNIX: `php -d extension=foo.so -d zend_extension=bar.so`
WIN: `php -d extension=php_foo.dll -d zend_extension=php_bar.dll`
RFC: `php -d extension=foo -d zend_extension=bar`
Are there really extension on Windows without `.dll` extension? I highly
doubt it and would consider erroring out to be okay. Users can still
specify the exact path if the want to.
function load_extension($name) {
$extension_dir = ini_get('extension_dir');
$extension_dir = rtrim($extension_dir, DIRECTORY_SEPARATOR);
$extension_dir .= DIRECTORY_SEPARATOR;
if (DIRECTORY_SEPARATOR === '\\') {
foreach (['php_', ''] as $prefix) {
$path = $extension_dir . $prefix . $name . '.dll';
if (is_file($path)) {
return do_load_extension($path);
}
}
else {
$path = $extension_dir . $name . '.so';
if (is_file($path)) {
return do_load_extension($path);
}
}
return do_load_extension($name);
}
Something along these lines should do it (of course in C). :)
--
Richard "Fleshgrinder" Fussenegger
signature.asc
Description: OpenPGP digital signature
