fixed the dynamic loading of the session extension (was missing the PHP_SHLIB_{PREFIX&SUFFIX})

This commit is contained in:
Ralf Becker 2005-03-07 06:42:17 +00:00
parent 96a9356854
commit 4df4f22337

View File

@ -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'))
{
// 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');