From 4df4f2233754e8b474230b604a1a81867cca257c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 7 Mar 2005 06:42:17 +0000 Subject: [PATCH] fixed the dynamic loading of the session extension (was missing the PHP_SHLIB_{PREFIX&SUFFIX}) --- phpgwapi/inc/class.sessions.inc.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index 695a2c746d..07b596163e 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -1304,8 +1304,21 @@ { $GLOBALS['phpgw_info']['server']['sessions_type'] = 'php4'; // the more performant default } - if ($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4' && !extension_loaded('session') && !@dl('session')) + // for php4 sessions, check if the extension is loaded, try loading it and fallback to db sessions if not + if ($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4' && !extension_loaded('session')) { - $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db'; // fallback if we have no php4 sessions support + // some constanst for pre php4.3 + if (!defined('PHP_SHLIB_SUFFIX')) + { + define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so'); + } + if (!defined('PHP_SHLIB_PREFIX')) + { + define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); + } + if (!function_exists('dl') || !@dl(PHP_SHLIB_PREFIX.'session'.'.'.PHP_SHLIB_SUFFIX)) + { + $GLOBALS['phpgw_info']['server']['sessions_type'] = 'db'; // fallback if we have no php4 sessions support + } } include_once(PHPGW_API_INC.'/class.sessions_'.$GLOBALS['phpgw_info']['server']['sessions_type'].'.inc.php');