Ejemplo n.º 1
0
function loader_compatibility_test($loader_location)
{
    $errors = array();
    $sysinfo = get_sysinfo();
    if (LOADER_NAME_CHECK) {
        $installed_loader_name = basename($loader_location);
        $expected_loader_name = get_loader_name();
        if ($installed_loader_name != $expected_loader_name) {
            $errors[ERROR_LOADER_UNEXPECTED_NAME] = "The installed loader (<code>{$installed_loader_name}</code>) does not have the name expected (<code>{$expected_loader_name}</code>) for your system. Please check that you have the correct loader for your system.";
        }
    }
    if (empty($errors) && !is_readable($loader_location)) {
        $execute_error = "The loader at {$loader_location} does not appear to be readable.";
        $execute_error .= "<br>Please check that it exists and is readable.";
        $execute_error .= "<br>Please also check the permissions of the containing ";
        $execute_error .= (is_ms_windows() ? 'folder' : 'directory') . '.';
        if ($sysinfo['SS'] == 'IIS' || !($sysinfo['IS_CGI'] || $sysinfo['IS_CLI'])) {
            $execute_error .= "<br>Please also check that the web server has been restarted.";
        }
        $execute_error .= ".";
        $errors[ERROR_LOADER_NOT_READABLE] = $execute_error;
    }
    $loader_strs = get_loader_strings($loader_location);
    $phpv = php_version();
    if (preg_match("/php version:\\s*(.)\\.(.)\\.(..?)(-ts)?/i", $loader_strs, $version_matches)) {
        if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
            $loader_php = $version_matches[1] . "." . $version_matches[2];
            $server_php = $phpv['major'] . "." . $phpv['minor'];
            $errors[ERROR_LOADER_PHP_MISMATCH] = "The installed loader is for PHP {$loader_php} but your server is running PHP {$server_php}.";
        }
        if (is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'] && !is_ms_windows() && !(isset($version_matches[4]) && $version_matches[4] == '-ts')) {
            $errors[ERROR_LOADER_NONTS_PHP_TS] = "Your server is running a thread-safe version of PHP but the loader is not a thread-safe version.";
        } elseif (isset($version_matches[4]) && $version_matches[4] == '-ts' && !(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'])) {
            $errors[ERROR_LOADER_TS_PHP_NONTS] = "Your server is running a non-thread-safe version of PHP but the loader is a thread-safe version.";
        }
    } elseif (preg_match("/ioncube_loader_.\\.._(.)\\.(.)\\.(..?)(_nonts)?\\.dll/i", $loader_strs, $version_matches)) {
        if (!is_ms_windows()) {
            $errors[ERROR_LOADER_WIN_SERVER_NONWIN] = "You have a Windows loader but your server does not appear to be running Windows.";
        } else {
            if (isset($version_matches[4]) && $version_matches[4] == '_nonts' && is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) {
                $errors[ERROR_LOADER_WIN_NONTS_PHP_TS] = "You have the non-thread-safe version of the Windows loader but you need the thread-safe one.";
            } elseif (!(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) && !(isset($version_matches[4]) && $version_matches[4] == '_nonts')) {
                $errors[ERROR_LOADER_WIN_TS_PHP_NONTS] = "You have the thread-safe version of the Windows loader but you need the non-thread-safe one.";
            }
            if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
                $loader_php = $version_matches[1] . "." . $version_matches[2];
                $server_php = $phpv['major'] . "." . $phpv['minor'];
                $errors[ERROR_LOADER_WIN_PHP_MISMATCH] = "The installed loader is for PHP {$loader_php} but your server is running PHP {$server_php}.";
            }
            if (preg_match("/assemblyIdentity.*version=\"([^.]+)\\./", $loader_strs, $compiler_matches)) {
                $loader_compiler = "VC" . strtoupper($compiler_matches[1]);
            } else {
                $loader_compiler = 'VC6';
            }
            if ($loader_compiler != $sysinfo['PHP_COMPILER']) {
                $errors[ERROR_LOADER_WIN_COMPILER_MISMATCH] = "Your loader was built using {$loader_compiler} but you need the loader built using {$sysinfo['PHP_COMPILER']}.";
            }
        }
    } else {
        $errors[ERROR_LOADER_PHP_VERSION_UNKNOWN] = "The PHP version for the loader cannot be determined - please check that you have a valid ionCube Loader.";
    }
    $errors += os_arch_string_check($loader_strs);
    return $errors;
}
Ejemplo n.º 2
0
function loader_compatibility_test($loader_location)
{
    $errors = array();
    $sysinfo = get_sysinfo();
    if (LOADER_NAME_CHECK) {
        $installed_loader_name = basename($loader_location);
        $expected_loader_name = get_loader_name();
        if ($installed_loader_name != $expected_loader_name) {
            $errors[ERROR_LOADER_UNEXPECTED_NAME] = "安装的loader (<code>{$installed_loader_name}</code>) 不是系统支持的loader (<code>{$expected_loader_name}</code>) 。 请检查loader与系统是否兼容。";
        }
    }
    if (empty($errors) && !is_readable($loader_location)) {
        $execute_error = "{$loader_location下的loader不可读。}";
        $execute_error .= "<br>请检查它是否存在或可读。";
        $execute_error .= "<br>请检查目录权限 ";
        $execute_error .= (is_ms_windows() ? 'folder' : 'directory') . '.';
        if ($sysinfo['SS'] == 'IIS' || !($sysinfo['IS_CGI'] || $sysinfo['IS_CLI'])) {
            $execute_error .= "<br>请检查服务器是否已经重启了。";
        }
        $execute_error .= ".";
        $errors[ERROR_LOADER_NOT_READABLE] = $execute_error;
    }
    $loader_strs = get_loader_strings($loader_location);
    $phpv = php_version();
    if (preg_match("/php version:\\s*(.)\\.(.)\\.(..?)(-ts)?/i", $loader_strs, $version_matches)) {
        if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
            $loader_php = $version_matches[1] . "." . $version_matches[2];
            $server_php = $phpv['major'] . "." . $phpv['minor'];
            $errors[ERROR_LOADER_PHP_MISMATCH] = "安装的loader用于 PHP {$loader_php,但服务器是} PHP {$server_php}.";
        }
        if (is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'] && !is_ms_windows() && !(isset($version_matches[4]) && $version_matches[4] == '-ts')) {
            $errors[ERROR_LOADER_NONTS_PHP_TS] = "服务器运行的PHP是线程安全的,但是该loader不是线程安全的。";
        } elseif (isset($version_matches[4]) && $version_matches[4] == '-ts' && !(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE'])) {
            $errors[ERROR_LOADER_TS_PHP_NONTS] = "服务器运行的PHP版本是非线程安全的,但该版本的loader是线程安全的。";
        }
    } elseif (preg_match("/ioncube_loader_.\\.._(.)\\.(.)\\.(..?)(_nonts)?\\.dll/i", $loader_strs, $version_matches)) {
        if (!is_ms_windows()) {
            $errors[ERROR_LOADER_WIN_SERVER_NONWIN] = "这是一个Windows版本的loader,但服务器好像不是Windows系统。";
        } else {
            if (isset($version_matches[4]) && $version_matches[4] == '_nonts' && is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) {
                $errors[ERROR_LOADER_WIN_NONTS_PHP_TS] = "该loader版本是非线程安全的,这里需要一个线程安全的版本。";
            } elseif (!(is_bool($sysinfo['THREAD_SAFE']) && $sysinfo['THREAD_SAFE']) && !(isset($version_matches[4]) && $version_matches[4] == '_nonts')) {
                $errors[ERROR_LOADER_WIN_TS_PHP_NONTS] = "该loader版本是线程安全的,这里需要一个非线程安全的版本。";
            }
            if ($version_matches[1] != $phpv['major'] || $version_matches[2] != $phpv['minor']) {
                $loader_php = $version_matches[1] . "." . $version_matches[2];
                $server_php = $phpv['major'] . "." . $phpv['minor'];
                $errors[ERROR_LOADER_WIN_PHP_MISMATCH] = "已安装的loader用于 PHP {$loader_php} ,但服务器的PHP版本是 {$server_php}.";
            }
            if (preg_match("/assemblyIdentity.*version=\"([^.]+)\\./", $loader_strs, $compiler_matches)) {
                $loader_compiler = "VC" . strtoupper($compiler_matches[1]);
            } else {
                $loader_compiler = 'VC6';
            }
            if ($loader_compiler != $sysinfo['PHP_COMPILER']) {
                $errors[ERROR_LOADER_WIN_COMPILER_MISMATCH] = "该loader用 {$loader_compiler} 编译,这里需要用 {$sysinfo['PHP_COMPILER']}编译。";
            }
        }
    } else {
        $errors[ERROR_LOADER_PHP_VERSION_UNKNOWN] = "未能检测服务器的PHP版本 - 请自行安装可用的loader。";
    }
    $errors += os_arch_string_check($loader_strs);
    return $errors;
}