function find_loader() { $sysinfo = get_sysinfo(); $php_ini = $sysinfo['PHP_INI']; if (is_readable($php_ini)) { return get_loader_location_from_ini($php_ini); } else { $loader_name = get_loader_name(); if (file_exists($loader_name)) { return $loader_name; } else { $ld_loc = get_loader_location(); if (file_exists($ld_loc)) { return $ld_loc; } else { if (!file_exists($php_ini)) { return array('Loader could not be found - php.ini file does not exist.'); } else { return array('Loader could not be found - unsuccessfully tried reading php.ini.'); } } } } }
function scan_inis_for_loader() { $ldloc = ''; $sysinfo = get_sysinfo(); if (empty($sysinfo['PHP_INI'])) { $ini_files_not_found = array("Main ini file"); $ini_file_list = get_additional_ini_files(); } else { $ini_files_not_found = array(); $ini_file_list = array_merge(array($sysinfo['PHP_INI']), get_additional_ini_files()); } $server_type = find_server_type(); $shared_server = SERVER_SHARED == $server_type; foreach ($ini_file_list as $f) { $ldloc = get_loader_location_from_ini($f); if (array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND, $ldloc['errors'])) { unset($ldloc['errors'][ERROR_INI_ZE_LINE_NOT_FOUND]); } if ($shared_server && array_key_exists(ERROR_INI_NOT_FOUND, $ldloc['errors'])) { if (false == user_ini_space_path($f)) { $ldloc['errors'][ERROR_INI_NOT_FOUND] = "安装向导不能找到或读取系统的ini文件,在该共享服务器上不能继续进行安装。"; } else { $ldloc['errors'][ERROR_INI_USER_INI_NOT_FOUND] = $ldloc['errors'][ERROR_INI_NOT_FOUND]; } } elseif (array_key_exists(ERROR_INI_NOT_FOUND, $ldloc['errors'])) { $ini_files_not_found[] = $f; } if (!empty($ldloc['location'])) { break; } } if (!empty($ini_files_not_found)) { $plural = count($ini_files_not_found) > 1 ? "s" : ""; $ldloc['errors'][ERROR_INI_NOT_FOUND] = "向导没有找到以下配置文件: " . join(',', $ini_files_not_found); if (is_restricted_server()) { $ldloc['errors'][ERROR_INI_NOT_FOUND] .= "<br>可能是服务器进行了限制。"; } } if (empty($ldloc['location'])) { $ldloc['errors'][ERROR_INI_ZE_LINE_NOT_FOUND] = "配置文件没有找到Zend扩展。"; } return $ldloc; }
function scan_inis_for_loader() { $ldloc = ''; $sysinfo = get_sysinfo(); if (empty($sysinfo['PHP_INI'])) { $ini_files_not_found = array("Main ini file"); $ini_file_list = get_additional_ini_files(); } else { $ini_files_not_found = array(); $ini_file_list = array_merge(array($sysinfo['PHP_INI']), get_additional_ini_files()); } $server_type = find_server_type(); $shared_server = SERVER_SHARED == $server_type; foreach ($ini_file_list as $f) { $ldloc = get_loader_location_from_ini($f); if (array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND, $ldloc['errors'])) { unset($ldloc['errors'][ERROR_INI_ZE_LINE_NOT_FOUND]); } if ($shared_server && array_key_exists(ERROR_INI_NOT_FOUND, $ldloc['errors'])) { if (false == user_ini_space_path($f)) { $ldloc['errors'][ERROR_INI_NOT_FOUND] = "A system ini file cannot be found or read by the Wizard - you cannot do anything about this on your shared server."; } else { $ldloc['errors'][ERROR_INI_USER_INI_NOT_FOUND] = $ldloc['errors'][ERROR_INI_NOT_FOUND]; } } elseif (array_key_exists(ERROR_INI_NOT_FOUND, $ldloc['errors'])) { $ini_files_not_found[] = $f; } if (!empty($ldloc['location'])) { break; } } if (!empty($ini_files_not_found)) { $plural = count($ini_files_not_found) > 1 ? "s" : ""; $ldloc['errors'][ERROR_INI_NOT_FOUND] = "The following ini file{$plural} could not be found by the Wizard: " . join(',', $ini_files_not_found); if (is_restricted_server()) { $ldloc['errors'][ERROR_INI_NOT_FOUND] .= "<br> This may be due to server restrictions in place."; } } if (empty($ldloc['location'])) { $ldloc['errors'][ERROR_INI_ZE_LINE_NOT_FOUND] = "The necessary zend_extension line could not be found in the configuration."; } return $ldloc; }
function zend_extension_instructions($server_type,$loader_dir) { $sysinfo = get_sysinfo(); $editing_ini = true; $php_ini_name = ini_file_name(); if (is_bool($sysinfo['THREAD_SAFE'])) { $kwd = zend_extension_line_start(); } else { $kwd = 'zend_extension/zend_extension_ts'; } $zend_extension_lines = zend_extension_lines($loader_dir); if (SERVER_SHARED_INI == $server_type) { $html_dir = shared_ini_location(); $ini_path = $html_dir . "/" . $php_ini_name; if (file_exists($ini_path)) { $loader_loc = get_loader_location_from_ini($ini_path); $missing_ze_line = is_array($loader_loc) && array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND,$loader_loc); if ($missing_ze_line && is_writeable($ini_path)) { if (function_exists('file_get_contents')) { $ini_strs = @file_get_contents($ini_path); } else { $lines = @file($ini_path); $ini_strs = join(' ',$lines); } $fh = fopen($ini_path,"w"); foreach ($zend_extension_lines as $zl) { fwrite($fh,$zl . PHP_EOL); } fwrite($fh,$ini_strs); fclose($fh); $editing_ini = false; echo "<li>Your php.ini file at $ini_path has been modified to include the necessary line for the ionCube Loader."; } else { echo "<li>Edit the <code>$php_ini_name</code> in your <code>$html_dir</code> directory"; } } else { if (is_writeable($html_dir)) { $fh = fopen($ini_path,"w"); foreach ($zend_extension_lines as $zl) { fwrite($fh,$zl . PHP_EOL); } fwrite($fh,$ini_strs); fclose($fh); echo "<li>A <code>$php_ini_name</code> file has been created for you in <code>$html_dir</code>."; } else { echo "<li><a href=\"$self?page=phpini\">Save this <code>$php_ini_name</code> file</a> and upload it to your html directory, <code>$html_dir</code>"; } $editing_ini = false; } } elseif (!empty($sysinfo['PHP_INI'])) { if (empty($sysinfo['PHP_INI_DIR'])) { echo "<li>Edit the file <code>${sysinfo['PHP_INI']}</code>"; } else { $php_ini_name = 'ioncube.ini'; echo "<li><a href=\"$self?page=phpini&ininame=$php_ini_name\">Save this $php_ini_name file</a> and put it in your ini files directory, <code>${sysinfo['PHP_INI_DIR']}</code>"; $editing_ini = false; } } else { echo "<li>Edit the system <code>$php_ini_name</code> file"; } if ($editing_ini) { echo " and <b>before</b> any other $kwd lines add:<br>"; foreach ($zend_extension_lines as $zl) { echo "<code>$zl</code><br>"; } if (isset($sysinfo['PHP_INI']) && file_exists($sysinfo['PHP_INI'])) { $loader_loc = get_loader_location_from_ini(); $missing_ze_line = is_array($loader_loc) && array_key_exists(ERROR_INI_ZE_LINE_NOT_FOUND,$loader_loc); if ($missing_ze_line) { echo "<a>Alternatively, replace your current <code>${sysinfo['PHP_INI']}</code> file with <a href=\"$self?page=phpconfig&download=1&prepend=1\">this new $php_ini_name file</a>."; } } } echo '</li>'; }