Bug #17798 Updated: OS Independat Extension Loading dl()

From: Date: Mon, 17 Jun 2002 11:25:16 +0000
Subject: Bug #17798 Updated: OS Independat Extension Loading dl()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10845@lists.php.net to get a copy of this message
ID: 17798 Updated by: cox@idecnet.com Reported By: cox@idecnet.com Status: Closed Bug Type: Feature/Change Request Operating System: All PHP Version: 4.2.1 New Comment: It will work for Windows too? AFAIK extensions there are in the form "php_<ext>.dll". Anyways I found the PHP_SHLIB_SUFFIX "hack" still obscure and ugly. Is so difficult to do it automatically? Tomas V.V.Cox Previous Comments: ------------------------------------------------------------------------ [2002-06-17 07:17:12] edink@php.net Stig already added constant PHP_SHLIB_SUFFIX so you can do something like (in PHP >= 4.3.0): dl($ext.'.'.PHP_SHLIB_SUFFIX); ------------------------------------------------------------------------ [2002-06-17 07:07:47] cox@idecnet.com Change the actual behaviour of dl() to be OS independant, avoiding the actual workarround: + if (!extension_loaded($ext)) { + if (OS_WINDOWS) { + return @dl("php_$ext.dll"); + } elseif (PHP_OS == 'HP-UX') { + return @dl("$ext.sl"); + } elseif (PHP_OS == 'AIX') { + return @dl("$ext.a"); + } else { + return @dl("$ext.so"); + } + } + return true; -- Tomas V.V.Cox ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17798&edit=1

« previous php.bugs (#10845) next »