> The idea is to use the same set of "extension=foo" directives for all
> platforms (nearly all). It is relatively obvious that extension_dir
> will differ.

IMHO, it should also allow to dl() by extension name, but only as a fallback 
mechanism to keep BC. 
First consider the argument as a filename, then, if it cannot be loaded, try to 
add the prefix/suffix
corresponding to the current architecture. Performance aspects shouldn't matter 
for dl().

Here is an example of the logic to implement, taken from the PHK code (I think 
it is the same in PEAR
now, with the HP-UX case added recently) :

public static function require_extension($ext)
{
if (extension_loaded($ext)) return;

if (ini_get('enable_dl') != 1)
        trigger_error($ext.': Cannot load extension when enable_dl is Off'
                ,E_USER_ERROR);
if (ini_get('safe_mode') == 1)
        trigger_error($ext.': Cannot load extension in safe mode',E_USER_ERROR);

if (substr(PHP_OS, 0, 3) == 'WIN') $suffix = '.dll';
elseif (PHP_OS == 'HP-UX') $suffix = '.sl';
elseif (PHP_OS == 'AIX') $suffix = '.a';
elseif (PHP_OS == 'OSX') $suffix = '.bundle';
else $suffix = '.so';

@dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
if (!extension_loaded($ext)) throw new Exception("$ext: Cannot load extension");
}

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to