Fix dl on windows

This commit is contained in:
Timothy Warren 2012-12-03 14:42:57 -05:00
parent abb126c400
commit 887dc7ff8d
1 changed files with 216 additions and 209 deletions

View File

@ -52,7 +52,7 @@ function log_fatal()
$fatal = [E_ERROR, E_PARSE, E_RECOVERABLE_ERROR];
// Log error.
if(in_array($error['type'], $fatal))
//if(in_array($error['type'], $fatal))
{
file_put_contents('errors.txt', print_r($error, TRUE), FILE_APPEND);
}
@ -66,12 +66,19 @@ register_shutdown_function('OpenSQLManager\log_fatal');
if ( ! class_exists('wxApp'))
{
// Try to load wxphp if possible
if (function_exists('dl') && in_array(php_sapi_name(), ['cli', 'embed']))
// Windows is special
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
$name = 'wxwidgets.'.PHP_SHLIB_SUFFIX;
dl($name);
$name = 'php_wxwidgets.dll';
}
else
{
$name .= 'wxwidgets.'.PHP_SHLIB_SUFFIX;
}
$res = dl($name);
if ( ! $res)
{
trigger_error("wxPHP not found. Please load the wxPHP extension in your php.ini", E_USER_ERROR);
die();