function zend_extension_instructions($server_type, $loader_dir) { $sysinfo = get_sysinfo(); $base = get_base_address(); $editing_ini = true; $php_ini_name = ini_file_name(); if (isset($sysinfo['PHP_INI']) && @file_exists($sysinfo['PHP_INI'])) { $php_ini_path = $sysinfo['PHP_INI']; } else { $php_ini_path = ''; } if (is_bool($sysinfo['THREAD_SAFE'])) { $kwd = zend_extension_line_start(); } else { $kwd = 'zend_extension/zend_extension_ts'; } $server_type_code = server_type_code(); $zend_extension_lines = zend_extension_lines($loader_dir); if (SERVER_SHARED == $server_type && own_php_ini_possible()) { $ini_dir = shared_ini_location(); $php_ini_path = $ini_dir . DIRECTORY_SEPARATOR . $php_ini_name; if (@file_exists($php_ini_path)) { $edit_line = "<li>Edit the <code>{$php_ini_name}</code> in the <code>{$ini_dir}</code> directory"; if (zend_extension_line_missing($php_ini_path) && @is_writeable($php_ini_path) && @is_writeable($ini_dir)) { if (function_exists('file_get_contents')) { $ini_strs = @file_get_contents($php_ini_path); } else { $lines = @file($php_ini_path); $ini_strs = join(' ', $lines); } $fh = @fopen($php_ini_path, "wb"); if ($fh !== false) { 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 {$php_ini_path} has been modified to include the necessary line for the ionCube Loader."; } else { echo $edit_line; } } else { echo $edit_line; } } else { $download_ini_file = "<li><a href=\"{$base}&page=phpconfig&ininame={$php_ini_name}&stype={$server_type_code}&download=1&prepend=1\">Save this <code>{$php_ini_name}</code> file</a> and upload it to <code>{$ini_dir}</code> (full path on your server)."; if (@is_writeable($ini_dir)) { $fh = @fopen($php_ini_path, "wb"); if ($fh !== false) { foreach ($zend_extension_lines as $zl) { fwrite($fh, $zl . PHP_EOL); } if (!empty($sysinfo['PHP_INI']) && is_readable($sysinfo['PHP_INI'])) { if (function_exists('file_get_contents')) { $ini_strs = @file_get_contents($sysinfo['PHP_INI']); } else { $lines = @file($sysinfo['PHP_INI']); $ini_strs = join(' ', $lines); } fwrite($fh, $ini_strs); } fclose($fh); echo "<li>A <code>{$php_ini_name}</code> file has been created for you in <code>{$ini_dir}</code>."; } else { echo $download_ini_file; } } else { echo $download_ini_file; } $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_path = find_additional_ioncube_ini(); if (empty($php_ini_path)) { $php_ini_name = ADDITIONAL_INI_FILE_NAME; echo "<li><a href=\"{$base}&page=phpconfig&download=1&newlinesonly=1&ininame={$php_ini_name}&stype={$server_type_code}\">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 { $php_ini_name = basename($php_ini_path); echo "<li>Edit the file <code>{$php_ini_path}</code>"; } } } else { echo "<li>Edit the system <code>{$php_ini_name}</code> file"; } if ($editing_ini) { echo " and <b>before</b> any other {$kwd} lines ensure that the following is included:<br>"; foreach ($zend_extension_lines as $zl) { echo "<code>{$zl}</code><br>"; } if (!empty($php_ini_path)) { if (zend_extension_line_missing($php_ini_path)) { echo "<a>Alternatively, replace your current <code>{$php_ini_path}</code> file with <a href=\"{$base}&page=phpconfig&ininame={$php_ini_name}&stype={$server_type_code}&download=1&prepend=1\">this new {$php_ini_name} file</a>."; } } } echo '</li>'; }
function zend_extension_instructions($server_type, $loader_dir) { $sysinfo = get_sysinfo(); $base = get_base_address(); $editing_ini = true; $php_ini_name = ini_file_name(); if (isset($sysinfo['PHP_INI']) && @file_exists($sysinfo['PHP_INI'])) { $php_ini_path = $sysinfo['PHP_INI']; } else { $php_ini_path = ''; } if (is_bool($sysinfo['THREAD_SAFE'])) { $kwd = zend_extension_line_start(); } else { $kwd = 'zend_extension/zend_extension_ts'; } $server_type_code = server_type_code(); $zend_extension_lines = zend_extension_lines($loader_dir); if (SERVER_SHARED == $server_type && own_php_ini_possible()) { $ini_dir = shared_ini_location(); $php_ini_path = $ini_dir . DIRECTORY_SEPARATOR . $php_ini_name; if (@file_exists($php_ini_path)) { $edit_line = "<li>Edit the <code>{$php_ini_name}</code> in the <code>{$ini_dir}</code> directory"; if (zend_extension_line_missing($php_ini_path) && @is_writeable($php_ini_path) && @is_writeable($ini_dir)) { if (function_exists('file_get_contents')) { $ini_strs = @file_get_contents($php_ini_path); } else { $lines = @file($php_ini_path); $ini_strs = join(' ', $lines); } $fh = @fopen($php_ini_path, "wb"); if ($fh !== false) { foreach ($zend_extension_lines as $zl) { fwrite($fh, $zl . PHP_EOL); } fwrite($fh, $ini_strs); fclose($fh); $editing_ini = false; echo "<li>{$php_ini_path下的php}.ini已经修改,包含了对ionCube loader的引用。"; } else { echo $edit_line; } } else { echo $edit_line; } } else { $download_ini_file = "<li><a href=\"{$base}&page=phpconfig&ininame={$php_ini_name}&stype={$server_type_code}&download=1&prepend=1\">保存<code>{$php_ini_name}</code></a>,并上传到<code>{$ini_dir}</code> (服务器的完整路径)。"; if (@is_writeable($ini_dir)) { $fh = @fopen($php_ini_path, "wb"); if ($fh !== false) { foreach ($zend_extension_lines as $zl) { fwrite($fh, $zl . PHP_EOL); } if (!empty($sysinfo['PHP_INI']) && is_readable($sysinfo['PHP_INI'])) { if (function_exists('file_get_contents')) { $ini_strs = @file_get_contents($sysinfo['PHP_INI']); } else { $lines = @file($sysinfo['PHP_INI']); $ini_strs = join(' ', $lines); } fwrite($fh, $ini_strs); } fclose($fh); echo "<li><code>{$php_ini_name}</code>已经在<code>{$ini_dir}</code>创建。"; } else { echo $download_ini_file; } } else { echo $download_ini_file; } $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_path = find_additional_ioncube_ini(); if (empty($php_ini_path)) { $php_ini_name = ADDITIONAL_INI_FILE_NAME; echo "<li><a href=\"{$base}&page=phpconfig&download=1&newlinesonly=1&ininame={$php_ini_name}&stype={$server_type_code}\">保存 {$php_ini_name}</a>,拷贝到ini目录, <code>{$sysinfo['PHP_INI_DIR']}</code>"; $editing_ini = false; } else { $php_ini_name = basename($php_ini_path); echo "<li>编辑文件<code>{$php_ini_path}</code>"; } } } else { echo "<li>编辑系统文件<code>{$php_ini_name}</code>"; } if ($editing_ini) { echo " 并且在其它{$kwd行}<b>之前</b>,确保下面的内容被包含:<br>"; foreach ($zend_extension_lines as $zl) { echo "<code>{$zl}</code><br>"; } if (!empty($php_ini_path)) { if (zend_extension_line_missing($php_ini_path)) { echo "<a>另外,下载<a href=\"{$base}&page=phpconfig&ininame={$php_ini_name}&stype={$server_type_code}&download=1&prepend=1\">新的 {$php_ini_name} 文件</a>,替换当前的<code>{$php_ini_path}</code> 文件。"; } } } echo '</li>'; }