function ioncube_will_work(&$what_to_do) { $sys_info = ic_system_info(); if ($sys_info['THREAD_SAFE'] && !$sys_info['CGI_CLI']) { return "(reason: multi-thread PHP build)"; } if ($sys_info['DEBUG_BUILD']) { return "(reason: debug PHP build)"; } if (ini_get('safe_mode')) { $what_to_do = "Ask your provider to enable safe_mode in php.ini file"; return "(safe_mode enabled in php.ini)"; } elseif (!ini_get('enable_dl')) { $what_to_do = "Ask your provider to enable safe_mode in php.ini file"; return "(enable_dl disabled in php.ini)"; } elseif (!is_dir($pp = realpath(ini_get('extension_dir')))) { $what_to_do = "Ask your provider to create folder: {$pp}"; return "(extension_dir setting in php.ini is incorrect - points to not-existing folder)"; } elseif (preg_match('/\\bdl\\b/', ini_get('disable_functions'))) { $what_to_do = "Ask your provider to allow 'dl' PHP function execution"; return "(dl function disabled in php.ini - disable_functions parameters set)"; } $_u = php_uname(); $_os = substr($_u, 0, strpos($_u, ' ')); $_os_key = strtolower(substr($_u, 0, 3)); $_php_version = phpversion(); $_php_family = substr($_php_version, 0, 3); $_loader_sfix = $_os_key == 'win' ? '.dll' : '.so'; $_ln_old = "ioncube_loader.{$_loader_sfix}"; if ($os_key == 'lin' || $os_key == 'fre') { $what_to_do = "Please get loader for {$_php_family} for {$_os} (file {$_ln_old}) \n <a href='http://www.ioncube.com/loaders/' target=_top>here</a> \n and upload it to /amember/ioncube/ folder"; } }
function get_sysinfo() { static $sysinfo; if (empty($sysinfo)) { $sysinfo = ic_system_info(); } return $sysinfo; }
<tr><th nowrap>PHP Version</th><td><?php echo $test . ' (' . phpversion() . ')'; ?> </td></tr> <?php /* ZEND OPTIMIZER CHECK */ $zend_passed = function_exists('zend_loader_enabled') && zend_loader_enabled(); $test = function_exists('zend_loader_enabled') && zend_loader_enabled() ? "<span class='passed'>Passed</span>" : "<span class='failed'>Failed - Zend Optimizer is not installed.</span><p>\n Zend Optimizer can be downloaded from <a href='http://www.zend.com/en/products/guard/optimizer/' target=_blank>http://www.zend.com</a>."; ?> <tr><th nowrap>Zend Optimizer</th><td><?php echo $test; ?> </td></tr> <?php /* IONCUBE CHECK */ $sys_info = ic_system_info(); $dl_required = false; ob_start(); if (!$already_installed) { if ($sys_info['THREAD_SAFE'] && !$sys_info['CGI_CLI']) { $errs[] = "Your PHP install appears to have threading support and run-time Loading\nis only possible on threaded web servers if using the CGI, FastCGI or\nCLI interface.{$nl}{$nl}To run encoded files please install the Loader in the php.ini file.{$nl}"; $ok = false; } if ($sys_info['DEBUG_BUILD']) { $errs[] = "Your PHP installation appears to be built with debugging support\nenabled and this is incompatible with ionCube Loaders.{$nl}{$nl}Debugging support in PHP produces slower execution, is\nnot recommended for production builds and was probably a mistake.{$nl}{$nl}You should rebuild PHP without the --enable-debug option and if\nyou obtained your PHP install from an RPM then the producer of the\nRPM should be notified so that it can be corrected.{$nl}"; $ok = false; } // // Check safe mode and for a valid extensions directory // if (ini_get('safe_mode')) {
function rtl_tester() { global $cli; global $nl; global $working; global $instructions; global $status; global $already_loaded; $working = ""; $status = ""; $instructions = ""; $ok = true; $already_installed = false; echo_working("\n"); // // Is the loader already installed? // if ($already_loaded) { echo_status("An ionCube Loader is already installed and run-time loading is unnecessary.\n" . "Encoded files should load without problems.{$nl}"); echo_instructions("If you have problems running encoded files, make sure that you select binary\n" . "mode if using FTP. If unpacking files with WinZIP you must also disable the\n" . "'TAR Smart CR/LF conversion' feature.{$nl}{$nl}"); $already_installed = true; } else { // // Intro // echo_working("Testing whether your system supports run-time loading...{$nl}{$nl}"); } // // Test some system info // $sys_info = ic_system_info(); if (!$already_installed) { if ($sys_info['THREAD_SAFE'] && !$sys_info['CGI_CLI']) { echo_status("Your PHP install appears to have threading support and run-time Loading\n" . "is only possible on threaded web servers if using the CGI, FastCGI or\n" . "CLI interface.{$nl}"); echo_instructions("To run encoded files please install the Loader in the php.ini file."); $ok = false; } if ($sys_info['DEBUG_BUILD']) { echo_status("Your PHP installation appears to be built with debugging support\n" . "enabled and this is incompatible with ionCube Loaders.{$nl}{$nl}Debugging support in PHP produces slower execution, is\n" . "not recommended for production builds and was probably a mistake.{$nl}"); echo_instructions("You should rebuild PHP without the --enable-debug option.{$nl}"); $ok = false; } // // Check safe mode and for a valid extensions directory // if (check_safe_mode()) { echo_status("PHP safe mode is enabled and run time loading will not be possible."); echo_instructions("To run encoded files please install the Loader in the php.ini file.\n" . "Alternatively contact your hosting provider or system administrator,\n" . "and ask them to disable safe mode for your account."); $ok = false; } /* elseif (!is_dir(realpath(ini_get('extension_dir')))) { echo "The setting of extension_dir in the php.ini file is not a directory or may not exist and run time loading will not be possible. You do not need write permissions on the extension_dir but for run-time loading to work a path from the extensions directory to wherever the Loader is installed must exist.$nl"; $ok = false; } */ // If ok to try and find a Loader if ($ok) { // // Look for a Loader // // Old style naming should be long gone now $test_old_name = false; $_u = php_uname(); $_os = substr($_u, 0, strpos($_u, ' ')); $_os_key = strtolower(substr($_u, 0, 3)); $_php_version = phpversion(); $_php_family = substr($_php_version, 0, 3); $_loader_sfix = $_os_key == 'win' ? '.dll' : '.so'; $_ln_old = "ioncube_loader.{$_loader_sfix}"; $_ln_old_loc = "/ioncube/{$_ln_old}"; $_ln_new = "ioncube_loader_{$_os_key}_{$_php_family}{$_loader_sfix}"; $_ln_new_loc = "/ioncube/{$_ln_new}"; echo_working("{$nl}Looking for Loader '{$_ln_new}'"); if ($test_old_name) { echo_working(" or '{$_ln_old}'"); } echo_working($nl . $nl); $_extdir = ini_get('extension_dir'); if ($_extdir == './') { $_extdir = '.'; } $_oid = $_id = realpath($_extdir); $_here = dirname(__FILE__); if (@$_id[1] == ':') { $_id = str_replace('\\', '/', substr($_id, 2)); $_here = str_replace('\\', '/', substr($_here, 2)); } $_rd = str_repeat('/..', substr_count($_id, '/')) . $_here . '/'; if ($_oid !== false) { echo_working("Extensions Dir: {$_extdir} ({$_id}){$nl}"); echo_working("Relative Path: {$_rd}{$nl}"); } else { echo_working("Extensions Dir: {$_extdir} (NOT FOUND){$nl}{$nl}"); echo_status("The directory set for the extension_dir entry in the\n" . "php.ini file may not exist, and run time loading will not be possible.{$nl}"); echo_instructions("Please ask your hosting provider or system administrator to create the\n" . "directory{$nl}{$nl}" . "{$_extdir}{$nl}{$nl}" . "ensuring that it is accessible by the web server software. They do not\n" . "need to restart the server. Then rerun this script. As an alternative,\n" . "your host could install the Loader in the php.ini file.{$nl}"); $ok = false; } if ($ok) { $_ln = ''; $_i = strlen($_rd); while ($_i--) { if ($_rd[$_i] == '/') { if ($test_old_name) { // Try the old style Loader name $_lp = substr($_rd, 0, $_i) . $_ln_old_loc; $_fqlp = $_oid . $_lp; if (@file_exists($_fqlp)) { echo_working("Found Loader: {$_fqlp}{$nl}"); $_ln = $_lp; break; } } // Try the new style Loader name $_lp = substr($_rd, 0, $_i) . $_ln_new_loc; $_fqlp = $_oid . $_lp; if (@file_exists($_fqlp)) { echo_working("Found Loader: {$_fqlp}{$nl}"); $_ln = $_lp; break; } } } // // If Loader not found, try the fallback of in the extensions directory // if (!$_ln) { if ($test_old_name) { if (@file_exists($_id . $_ln_old_loc)) { $_ln = $_ln_old_loc; } } if (@file_exists($_id . $_ln_new_loc)) { $_ln = $_ln_new_loc; } if ($_ln) { echo_working("Found Loader {$_ln} in extensions directory.{$nl}"); } } echo_working($nl); if ($_ln) { echo_working("Trying to install Loader - this may produce an error...{$nl}{$nl}"); dl($_ln); if (extension_loaded('ionCube Loader')) { echo_status("The Loader was successfully installed and encoded files should be able to\n" . "automatically install the Loader when needed.{$nl}"); echo_instructions("No changes to your php.ini file\n" . "are required to use encoded files on this system.{$nl}"); } else { echo_status("The Loader was not installed.{$nl}"); } } else { echo_status("Run-time loading should be possible on your system but no suitable Loader\n" . "was found.{$nl}{$nl}"); echo_instructions("The {$_os} Loader for PHP {$_php_family} releases is required.{$nl}" . "Loaders can be downloaded from " . weblink("http://www.ioncube.com/loaders.php", "www.ioncube.com")); } } } } //$instructions should never be empty. //if it is, then put default: if (empty($instructions)) { $instructions = "Run-time loading is not currently possible.{$nl}" . "If you require further assistance, please contact ionCube support providing{$nl}a link to this script."; } if ($cli) { return "{$working}{$status}{$instructions}\n"; } else { //echo "${nl}Please send the output of this script to $email if you have questions or require further assistance.$nl$nl"; $body = "<center><h2>Run-Time Loading Installation Instructions</h2></center>" . "<h3>Testing Server</h3>" . "{$working}" . "<h3>Results</h3>" . "{$status}" . "<h3>Instructions</h3>" . $instructions; return $body; } }
function ioncube_tester() { if (extension_loaded('ionCube Loader')) { return true; } // // Test some system info // $sys_info = ic_system_info(); if ($sys_info['THREAD_SAFE'] && !$sys_info['CGI_CLI']) { return false; } if ($sys_info['DEBUG_BUILD']) { return false; } // // Check safe mode and for a valid extensions directory // if (ini_get('safe_mode') == '1') { return false; } // Old style naming should be long gone now $test_old_name = false; $_u = php_uname(); $_os = substr($_u, 0, strpos($_u, ' ')); $_os_key = strtolower(substr($_u, 0, 3)); $_php_version = phpversion(); $_php_family = substr($_php_version, 0, 3); $_loader_sfix = $_os_key == 'win' ? '.dll' : '.so'; $_ln_old = "ioncube_loader.{$_loader_sfix}"; $_ln_old_loc = "/ioncube/{$_ln_old}"; $_ln_new = "ioncube_loader_{$_os_key}_{$_php_family}{$_loader_sfix}"; $_ln_new_loc = "/ioncube/{$_ln_new}"; $_extdir = ini_get('extension_dir'); if ($_extdir == './') { $_extdir = '.'; } $_oid = $_id = realpath($_extdir); $_here = dirname(__FILE__); if (@$_id[1] == ':') { $_id = str_replace('\\', '/', substr($_id, 2)); $_here = str_replace('\\', '/', substr($_here, 2)); } $_rd = str_repeat('/..', substr_count($_id, '/')) . $_here . '/'; if ($_oid === false) { return false; } $_ln = ''; $_i = strlen($_rd); while ($_i--) { if ($_rd[$_i] == '/') { if ($test_old_name) { // Try the old style Loader name $_lp = substr($_rd, 0, $_i) . $_ln_old_loc; $_fqlp = $_oid . $_lp; if (@file_exists($_fqlp)) { $_ln = $_lp; break; } } // Try the new style Loader name $_lp = substr($_rd, 0, $_i) . $_ln_new_loc; $_fqlp = $_oid . $_lp; if (@file_exists($_fqlp)) { $_ln = $_lp; break; } } } // // If Loader not found, try the fallback of in the extensions directory // if (!$_ln) { if ($test_old_name) { if (@file_exists($_id . $_ln_old_loc)) { $_ln = $_ln_old_loc; } } if (@file_exists($_id . $_ln_new_loc)) { $_ln = $_ln_new_loc; } } if ($_ln) { if (function_exists('dl')) { @dl($_ln); } if (extension_loaded('ionCube Loader')) { return true; } else { return false; } } return false; }