Re: [new] PEAR::assertExtension()
| From: | Tomas V.V.Cox | Date: | Mon, 17 Jun 2002 12:30:17 +0000 |
| Subject: | Re: [new] PEAR::assertExtension() | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7107@lists.php.net to get a copy of this message | ||
Markus Fischer wrote:
>
> I think you should test for both php_ex.suffix AND ex.suffix
> on every platform. I've seen linux modules being called
> php_whatever.so too.
>
Umm, what about this version:
function assertExtension($ext)
{
if (!extension_loaded($ext)) {
if (OS_WINDOWS) {
return (@dl("php_$ext.dll") || @dl("$ext.dll"));
} elseif (PHP_OS == 'HP-UX') {
return (@dl("$ext.sl") || @dl("php_$ext.sl"));
} elseif (PHP_OS == 'AIX') {
return (@dl("$ext.a") || @dl("php_$ext.a"));
} elseif (PHP_OS == 'OSX') {
return (@dl("$ext.bundle") || @dl("php_$ext.bundle"));
} else {
return (@dl("$ext.so") || @dl("php_$ext.so"));
}
}
return true;
}
Tomas V.V.Cox
PS.- I laught on the typical: dl($ext . (substr(PHP_OS, 0, 3) == 'WIN' ?
'dll' : 'so')); that people extensively use.