本文整理汇总了PHP中ioncube_loader_iversion函数的典型用法代码示例。如果您正苦于以下问题:PHP ioncube_loader_iversion函数的具体用法?PHP ioncube_loader_iversion怎么用?PHP ioncube_loader_iversion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ioncube_loader_iversion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: com_install
/**
* This function is required by JInstallerComponent in order to run this script
*
* @return boolean true
*/
function com_install()
{
static $installable;
if (isset($installable)) {
return $installable;
}
$db = JFactory::getDBO();
//Run check on the minimum required server specs. Will roll back install if any check fails
foreach (array(class_exists('mysqli') => "Your server don't have MySQLi.", version_compare(phpversion(), '5.2', '>=') => "Your PHP version is older than 5.2.", version_compare($db->getVersion(), '5.0.41', '>=') => "Your MySQL server version is older than 5.0.41.") as $succeed => $fail) {
if (!$succeed) {
JError::raiseWarning(0, $fail);
return $installable = false;
}
}
if (extension_loaded('suhosin')) {
//Attempt setting the whitelist value
@ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://');
//Checking if the whitelist is ok
if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) {
JError::raiseWarning(0, sprintf(JText::_('The install failed because your server has Suhosin loaded, but it\'s not configured correctly. Please follow <a href="%s" target="_blank">this</a> tutorial before you reinstall.'), 'https://nooku.assembla.com/wiki/show/nooku-framework/Known_Issues'));
return $installable = false;
}
}
if (version_compare('5.3', phpversion(), '<=') && extension_loaded('ionCube Loader')) {
if (ioncube_loader_iversion() < 40002) {
JError::raiseWarning(0, sprintf(JText::_('Your server is affected by a bug in ionCube Loader for PHP 5.3 that causes our template layout parsing to fail. Please update to a version later than ionCube Loader 4.0 (your server is %s) before reinstalling.'), ioncube_loader_version()));
return $installable = false;
}
}
return $installable = true;
}
示例2: getIonCubeVersion
function getIonCubeVersion()
{
if (function_exists('ioncube_loader_iversion')) {
$liv = ioncube_loader_iversion();
$lv = sprintf("%d.%d.%d", $liv / 10000, $liv / 100 % 100, $liv % 100);
return $lv;
} else {
return '';
}
}
示例3: ioncube_loader_version_array
function ioncube_loader_version_array()
{
if (function_exists('ioncube_loader_iversion')) {
$ioncube_loader_iversion = ioncube_loader_iversion();
$ioncube_loader_version_major = (int) substr($ioncube_loader_iversion, 0, 1);
$ioncube_loader_version_minor = (int) substr($ioncube_loader_iversion, 1, 2);
$ioncube_loader_version_revision = (int) substr($ioncube_loader_iversion, 3, 2);
$ioncube_loader_version = "{$ioncube_loader_version_major}.{$ioncube_loader_version_minor}.{$ioncube_loader_version_revision}";
} else {
$ioncube_loader_version = ioncube_loader_version();
$ioncube_loader_version_major = (int) substr($ioncube_loader_version, 0, 1);
$ioncube_loader_version_minor = (int) substr($ioncube_loader_version, 2, 1);
}
return array('version' => $ioncube_loader_version, 'major' => $ioncube_loader_version_major, 'minor' => $ioncube_loader_version_minor);
}
示例4: ioncube_loader_version_information
function ioncube_loader_version_information()
{
$old_version = true;
$liv = "";
if (function_exists('ioncube_loader_iversion')) {
$liv = ioncube_loader_iversion();
$lv = sprintf("%d.%d.%d", $liv / 10000, $liv / 100 % 100, $liv % 100);
if ($liv >= get_latestversion()) {
$old_version = false;
}
}
return array($lv, $old_version);
}
示例5: phpversion
</td>
</tr>
<tr>
<td>eAccelerator</td>
<td><?php
if (phpversion('eAccelerator') != '') {
echo phpversion('eAccelerator');
} else {
echo "<font color=red>×</font>";
}
?>
</td>
<td>ioncube</td>
<td><?php
if (extension_loaded('ionCube Loader')) {
$ys = ioncube_loader_iversion();
$gm = "." . (int) substr($ys, 3, 2);
echo ionCube_Loader_version() . $gm;
} else {
echo "<font color=red>×</font>";
}
?>
</td>
</tr>
<tr>
<td>XCache</td>
<td><?php
if (phpversion('XCache') != '') {
echo phpversion('XCache');
} else {
echo "<font color=red>×</font>";
示例6: checkPlatform
private function checkPlatform()
{
$output = '';
$out = function ($msg, $style) use(&$output) {
$output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
};
// code below taken from getcomposer.org/installer, any changes should be made there and replicated here
$errors = array();
$warnings = array();
$iniPath = php_ini_loaded_file();
$displayIniMessage = false;
if ($iniPath) {
$iniMessage = PHP_EOL . PHP_EOL . 'The php.ini used by your command-line PHP is: ' . $iniPath;
} else {
$iniMessage = PHP_EOL . PHP_EOL . 'A php.ini file does not exist. You will have to create one.';
}
$iniMessage .= PHP_EOL . 'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
if (!function_exists('json_decode')) {
$errors['json'] = true;
}
if (!extension_loaded('Phar')) {
$errors['phar'] = true;
}
if (!extension_loaded('filter')) {
$errors['filter'] = true;
}
if (!extension_loaded('hash')) {
$errors['hash'] = true;
}
if (!extension_loaded('ctype')) {
$errors['ctype'] = true;
}
if (!ini_get('allow_url_fopen')) {
$errors['allow_url_fopen'] = true;
}
if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
$errors['ioncube'] = ioncube_loader_version();
}
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
$errors['php'] = PHP_VERSION;
}
if (!isset($errors['php']) && version_compare(PHP_VERSION, '5.3.4', '<')) {
$warnings['php'] = PHP_VERSION;
}
if (!extension_loaded('openssl')) {
$errors['openssl'] = true;
}
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
$warnings['apc_cli'] = true;
}
ob_start();
phpinfo(INFO_GENERAL);
$phpinfo = ob_get_clean();
if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
$configure = $match[1];
if (false !== strpos($configure, '--enable-sigchild')) {
$warnings['sigchild'] = true;
}
if (false !== strpos($configure, '--with-curlwrappers')) {
$warnings['curlwrappers'] = true;
}
}
if (ini_get('xdebug.profiler_enabled')) {
$warnings['xdebug_profile'] = true;
} elseif (extension_loaded('xdebug')) {
$warnings['xdebug_loaded'] = true;
}
if (!empty($errors)) {
foreach ($errors as $error => $current) {
switch ($error) {
case 'json':
$text = PHP_EOL . "The json extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-json";
break;
case 'phar':
$text = PHP_EOL . "The phar extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-phar";
break;
case 'filter':
$text = PHP_EOL . "The filter extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-filter";
break;
case 'hash':
$text = PHP_EOL . "The hash extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-hash";
break;
case 'ctype':
$text = PHP_EOL . "The ctype extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-ctype";
break;
case 'unicode':
$text = PHP_EOL . "The detect_unicode setting must be disabled." . PHP_EOL;
$text .= "Add the following to the end of your `php.ini`:" . PHP_EOL;
$text .= " detect_unicode = Off";
$displayIniMessage = true;
break;
case 'suhosin':
$text = PHP_EOL . "The suhosin.executor.include.whitelist setting is incorrect." . PHP_EOL;
$text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):" . PHP_EOL;
$text .= " suhosin.executor.include.whitelist = phar " . $current;
//.........这里部分代码省略.........
示例7: checkPlatform
function checkPlatform($quiet, $disableTls)
{
$errors = [];
$warnings = [];
$iniPath = php_ini_loaded_file();
$displayIniMessage = FALSE;
if ($iniPath) {
$iniMessage = PHP_EOL . PHP_EOL . 'The php.ini used by your command-line PHP is: ' . $iniPath;
} else {
$iniMessage = PHP_EOL . PHP_EOL . 'A php.ini file does not exist. You will have to create one.';
}
$iniMessage .= PHP_EOL . 'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
if (ini_get('detect_unicode')) {
$errors['unicode'] = 'On';
}
if (extension_loaded('suhosin')) {
$suhosin = ini_get('suhosin.executor.include.whitelist');
$suhosinBlacklist = ini_get('suhosin.executor.include.blacklist');
if (FALSE === stripos($suhosin, 'phar') && (!$suhosinBlacklist || FALSE !== stripos($suhosinBlacklist, 'phar'))) {
$errors['suhosin'] = $suhosin;
}
}
if (!function_exists('json_decode')) {
$errors['json'] = TRUE;
}
if (!extension_loaded('Phar')) {
$errors['phar'] = TRUE;
}
if (!extension_loaded('filter')) {
$errors['filter'] = TRUE;
}
if (!extension_loaded('hash')) {
$errors['hash'] = TRUE;
}
if (!ini_get('allow_url_fopen')) {
$errors['allow_url_fopen'] = TRUE;
}
if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
$errors['ioncube'] = ioncube_loader_version();
}
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
$errors['php'] = PHP_VERSION;
}
if (version_compare(PHP_VERSION, '5.3.4', '<')) {
$warnings['php'] = PHP_VERSION;
}
if (!extension_loaded('openssl') && TRUE === $disableTls) {
$warnings['openssl'] = TRUE;
} elseif (!extension_loaded('openssl')) {
$errors['openssl'] = TRUE;
}
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
$warnings['apc_cli'] = TRUE;
}
ob_start();
phpinfo(INFO_GENERAL);
$phpinfo = ob_get_clean();
if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
$configure = $match[1];
if (FALSE !== strpos($configure, '--enable-sigchild')) {
$warnings['sigchild'] = TRUE;
}
if (FALSE !== strpos($configure, '--with-curlwrappers')) {
$warnings['curlwrappers'] = TRUE;
}
}
if (!empty($errors)) {
out("Some settings on your machine make Composer unable to work properly.", 'error');
out('Make sure that you fix the issues listed below and run this script again:', 'error');
foreach ($errors as $error => $current) {
switch ($error) {
case 'json':
$text = PHP_EOL . "The json extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-json";
break;
case 'phar':
$text = PHP_EOL . "The phar extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-phar";
break;
case 'filter':
$text = PHP_EOL . "The filter extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-filter";
break;
case 'hash':
$text = PHP_EOL . "The hash extension is missing." . PHP_EOL;
$text .= "Install it or recompile php without --disable-hash";
break;
case 'unicode':
$text = PHP_EOL . "The detect_unicode setting must be disabled." . PHP_EOL;
$text .= "Add the following to the end of your `php.ini`:" . PHP_EOL;
$text .= " detect_unicode = Off";
$displayIniMessage = TRUE;
break;
case 'suhosin':
$text = PHP_EOL . "The suhosin.executor.include.whitelist setting is incorrect." . PHP_EOL;
$text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):" . PHP_EOL;
$text .= " suhosin.executor.include.whitelist = phar " . $current;
$displayIniMessage = TRUE;
break;
case 'php':
//.........这里部分代码省略.........
示例8: ioncube_loader_version_information
function ioncube_loader_version_information()
{
$old_version = true;
$liv = "";
$lv = "";
$mv = 0;
if (function_exists('ioncube_loader_iversion')) {
$liv = ioncube_loader_iversion();
$lv = sprintf("%d.%d.%d", $liv / 10000, $liv / 100 % 100, $liv % 100);
$latest_version = get_latestversion();
$lat_parts = explode('.', $latest_version);
$cur_parts = explode('.', $lv);
if ($cur_parts[0] > $lat_parts[0] || $cur_parts[0] == $lat_parts[0] && $cur_parts[1] > $lat_parts[1] || $cur_parts[0] == $lat_parts[0] && $cur_parts[1] == $lat_parts[1] && $cur_parts[2] >= $lat_parts[2]) {
$old_version = false;
} else {
$old_version = $latest_version;
}
$mv = $cur_parts[0];
}
return array($lv, $mv, $old_version);
}
示例9: _e
_e('Zend Optimizer+ Extension is Loaded and Enabled', 'bulletproof-security');
}
if (extension_loaded('Zend Optimizer')) {
_e('Zend Optimizer Extension is Loaded', 'bulletproof-security');
}
if (extension_loaded('Zend Guard Loader')) {
_e('Zend Guard Loader Extension is Loaded', 'bulletproof-security');
} else {
if (!extension_loaded('Zend Optimizer+') && !extension_loaded('Zend Optimizer') && !extension_loaded('Zend Guard Loader')) {
_e('A Zend Extension is Not Loaded', 'bulletproof-security');
}
}
echo '</strong><br>';
echo __('ionCube Loader', 'bulletproof-security') . ': <strong>';
if (extension_loaded('IonCube Loader') && function_exists('ioncube_loader_iversion')) {
echo __('ionCube Loader Extension is Loaded ', 'bulletproof-security') . __('Version: ', 'bulletproof-security') . ioncube_loader_iversion();
} else {
echo __('ionCube Loader Extension is Not Loaded', 'bulletproof-security');
}
echo '</strong><br>';
echo __('Suhosin', 'bulletproof-security') . ': <strong>';
$bpsconstants = get_defined_constants();
if (isset($bpsconstants['SUHOSIN_PATCH']) && $bpsconstants['SUHOSIN_PATCH'] == 1) {
_e('The Suhosin-Patch is installed', 'bulletproof-security');
}
if (extension_loaded('suhosin')) {
_e('Suhosin-Extension is Loaded', 'bulletproof-security');
} else {
if (!isset($bpsconstants['SUHOSIN_PATCH']) && @$bpsconstants['SUHOSIN_PATCH'] != 1 && !extension_loaded('suhosin')) {
_e('Suhosin is Not Installed|Loaded', 'bulletproof-security');
}
示例10: sprintf
return $notify($condition, $message);
}
if (!version_compare(phpversion(), '5.2', '>=')) {
$message = JText::_('%s does not support PHP %s. The minimum requirement is PHP 5.2 or later.');
$message = sprintf($message, $extension_name, phpversion());
$condition = $user->authorize('com_config', 'manage');
return $notify($condition, $message);
}
if (!class_exists('mysqli')) {
$message = JText::_('%s needs the MySQLi (MySQL improved) PHP extension enabled in order to connect with your MySQL database server. MySQLi gives access to security and performance features in MySQL server 4.1 and higher.');
$message = sprintf($message, $extension_name);
$condition = $user->authorize('com_config', 'manage');
return $notify($condition, $message);
}
if (version_compare('5.3', phpversion(), '<=') && extension_loaded('ionCube Loader')) {
if (ioncube_loader_iversion() < 40002) {
$message = JText::_('Your server is affected by a bug in ionCube Loader for PHP 5.3 that causes our template layout parsing to fail. Please update to a version later than ionCube Loader 4.0 (your server is %s) before using %s.');
$message = sprintf($message, ioncube_loader_version(), $extension_name);
$condition = $user->authorize('com_config', 'manage');
//Don't return this one, in case the site still works with ionCube loader present
$notify($condition, $message);
}
}
// Check if Koowa is active
if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') {
$conf = JFactory::getConfig();
$path = JPATH_CONFIGURATION . DS . 'configuration.php';
if (JFile::exists($path)) {
JPath::setPermissions($path, '0644');
$search = JFile::read($path);
$replace = str_replace('var $dbtype = \'mysql\';', 'var $dbtype = \'mysqli\';', $search);
示例11: loadCheckionCubeVersion
/**
* Private: Check ionCube Version
*
* @param string ionCube minimum version
* @return boolean
*/
private function loadCheckionCubeVersion($version)
{
if (function_exists("ioncube_loader_iversion")) {
$ic_iversion = ioncube_loader_iversion();
$ic_version = sprintf("%d.%d.%d", $ic_iversion / 10000, $ic_iversion / 100 % 100, $ic_iversion % 100);
return version_compare($ic_version, $version, ">=");
} else {
return "0.0.0";
}
}
示例12: getPlatformIssues
/**
* Checks platform configuration for common incompatibility issues
*
* @param array $errors Populated by method
* @param array $warnings Populated by method
*
* @return bool If any errors or warnings have been found
*/
function getPlatformIssues(&$errors, &$warnings)
{
$errors = array();
$warnings = array();
if ($iniPath = php_ini_loaded_file()) {
$iniMessage = PHP_EOL . 'The php.ini used by your command-line PHP is: ' . $iniPath;
} else {
$iniMessage = PHP_EOL . 'A php.ini file does not exist. You will have to create one.';
}
$iniMessage .= PHP_EOL . 'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
if (ini_get('detect_unicode')) {
$errors['unicode'] = array('The detect_unicode setting must be disabled.', 'Add the following to the end of your `php.ini`:', ' detect_unicode = Off', $iniMessage);
}
if (extension_loaded('suhosin')) {
$suhosin = ini_get('suhosin.executor.include.whitelist');
$suhosinBlacklist = ini_get('suhosin.executor.include.blacklist');
if (false === stripos($suhosin, 'phar') && (!$suhosinBlacklist || false !== stripos($suhosinBlacklist, 'phar'))) {
$errors['suhosin'] = array('The suhosin.executor.include.whitelist setting is incorrect.', 'Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):', ' suhosin.executor.include.whitelist = phar ' . $suhosin, $iniMessage);
}
}
if (!function_exists('json_decode')) {
$errors['json'] = array('The json extension is missing.', 'Install it or recompile php without --disable-json');
}
if (!extension_loaded('Phar')) {
$errors['phar'] = array('The phar extension is missing.', 'Install it or recompile php without --disable-phar');
}
if (!extension_loaded('filter')) {
$errors['filter'] = array('The filter extension is missing.', 'Install it or recompile php without --disable-filter');
}
if (!extension_loaded('hash')) {
$errors['hash'] = array('The hash extension is missing.', 'Install it or recompile php without --disable-hash');
}
if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
$errors['iconv_mbstring'] = array('The iconv OR mbstring extension is required and both are missing.', 'Install either of them or recompile php without --disable-iconv');
}
if (!ini_get('allow_url_fopen')) {
$errors['allow_url_fopen'] = array('The allow_url_fopen setting is incorrect.', 'Add the following to the end of your `php.ini`:', ' allow_url_fopen = On', $iniMessage);
}
if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
$ioncube = ioncube_loader_version();
$errors['ioncube'] = array('Your ionCube Loader extension (' . $ioncube . ') is incompatible with Phar files.', 'Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:', ' zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so', $iniMessage);
}
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
$errors['php'] = array('Your PHP (' . PHP_VERSION . ') is too old, you must upgrade to PHP 5.3.2 or higher.');
}
if (version_compare(PHP_VERSION, '5.3.4', '<')) {
$warnings['php'] = array('Your PHP (' . PHP_VERSION . ') is quite old, upgrading to PHP 5.3.4 or higher is recommended.', 'Composer works with 5.3.2+ for most people, but there might be edge case issues.');
}
if (!extension_loaded('openssl')) {
$warnings['openssl'] = array('The openssl extension is missing, which means that secure HTTPS transfers are impossible.', 'If possible you should enable it or recompile php with --with-openssl');
}
if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
// Attempt to parse version number out, fallback to whole string value.
$opensslVersion = trim(strstr(OPENSSL_VERSION_TEXT, ' '));
$opensslVersion = substr($opensslVersion, 0, strpos($opensslVersion, ' '));
$opensslVersion = $opensslVersion ? $opensslVersion : OPENSSL_VERSION_TEXT;
$warnings['openssl_version'] = array('The OpenSSL library (' . $opensslVersion . ') used by PHP does not support TLSv1.2 or TLSv1.1.', 'If possible you should upgrade OpenSSL to version 1.0.1 or above.');
}
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
$warnings['apc_cli'] = array('The apc.enable_cli setting is incorrect.', 'Add the following to the end of your `php.ini`:', ' apc.enable_cli = Off', $iniMessage);
}
if (extension_loaded('xdebug')) {
$warnings['xdebug_loaded'] = array('The xdebug extension is loaded, this can slow down Composer a little.', 'Disabling it when using Composer is recommended.');
if (ini_get('xdebug.profiler_enabled')) {
$warnings['xdebug_profile'] = array('The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.', 'Add the following to the end of your `php.ini` to disable it:', ' xdebug.profiler_enabled = 0', $iniMessage);
}
}
ob_start();
phpinfo(INFO_GENERAL);
$phpinfo = ob_get_clean();
if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
$configure = $match[1];
if (false !== strpos($configure, '--enable-sigchild')) {
$warnings['sigchild'] = array('PHP was compiled with --enable-sigchild which can cause issues on some platforms.', 'Recompile it without this flag if possible, see also:', ' https://bugs.php.net/bug.php?id=22999');
}
if (false !== strpos($configure, '--with-curlwrappers')) {
$warnings['curlwrappers'] = array('PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.', 'Recompile it without this flag if possible');
}
}
// Stringify the message arrays
foreach ($errors as $key => $value) {
$errors[$key] = PHP_EOL . implode(PHP_EOL, $value);
}
foreach ($warnings as $key => $value) {
$warnings[$key] = PHP_EOL . implode(PHP_EOL, $value);
}
return !empty($errors) || !empty($warnings);
}
示例13: validateSystem
/**
* Check the platform for possible issues on running Puli.
*
* @return bool Whether the platform requirements are satisfied.
*/
private function validateSystem()
{
$errors = array();
$warnings = array();
$iniPath = php_ini_loaded_file();
$displayIniMessage = false;
if ($iniPath) {
$iniMessage = PHP_EOL . PHP_EOL . 'The php.ini used by your command-line PHP is: ' . $iniPath;
} else {
$iniMessage = PHP_EOL . PHP_EOL . 'A php.ini file does not exist. You will have to create one.';
}
$iniMessage .= PHP_EOL . 'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
if (ini_get('detect_unicode')) {
$errors['unicode'] = 'On';
}
if (extension_loaded('suhosin')) {
$suhosin = ini_get('suhosin.executor.include.whitelist');
$suhosinBlacklist = ini_get('suhosin.executor.include.blacklist');
if (false === stripos($suhosin, 'phar') && (!$suhosinBlacklist || false !== stripos($suhosinBlacklist, 'phar'))) {
$errors['suhosin'] = $suhosin;
}
}
if (!function_exists('json_decode')) {
$errors['json'] = true;
}
if (!extension_loaded('Phar')) {
$errors['phar'] = true;
}
if (!ini_get('allow_url_fopen')) {
$errors['allow_url_fopen'] = true;
}
if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
$errors['ioncube'] = ioncube_loader_version();
}
if (version_compare(PHP_VERSION, '5.3.9', '<')) {
$errors['php'] = PHP_VERSION;
}
if (!extension_loaded('openssl')) {
$errors['openssl'] = true;
}
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
$warnings['apc_cli'] = true;
}
ob_start();
phpinfo(INFO_GENERAL);
$phpinfo = ob_get_clean();
if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
$configure = $match[1];
if (false !== strpos($configure, '--enable-sigchild')) {
$warnings['sigchild'] = true;
}
if (false !== strpos($configure, '--with-curlwrappers')) {
$warnings['curlwrappers'] = true;
}
}
if (!empty($errors)) {
$this->error('Some settings on your machine make Puli unable to work properly.');
$this->error('Make sure that you fix the issues listed below and run this script again:');
foreach ($errors as $error => $current) {
$text = '';
switch ($error) {
case 'json':
$text = PHP_EOL . 'The json extension is missing.' . PHP_EOL;
$text .= 'Install it or recompile php without --disable-json';
break;
case 'phar':
$text = PHP_EOL . 'The phar extension is missing.' . PHP_EOL;
$text .= 'Install it or recompile php without --disable-phar';
break;
case 'unicode':
$text = PHP_EOL . 'The detect_unicode setting must be disabled.' . PHP_EOL;
$text .= 'Add the following to the end of your `php.ini`:' . PHP_EOL;
$text .= ' detect_unicode = Off';
$displayIniMessage = true;
break;
case 'suhosin':
$text = PHP_EOL . 'The suhosin.executor.include.whitelist setting is incorrect.' . PHP_EOL;
$text .= 'Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):' . PHP_EOL;
$text .= ' suhosin.executor.include.whitelist = phar ' . $current;
$displayIniMessage = true;
break;
case 'php':
$text = PHP_EOL . "Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.9 or higher.";
break;
case 'allow_url_fopen':
$text = PHP_EOL . 'The allow_url_fopen setting is incorrect.' . PHP_EOL;
$text .= 'Add the following to the end of your `php.ini`:' . PHP_EOL;
$text .= ' allow_url_fopen = On';
$displayIniMessage = true;
break;
case 'ioncube':
$text = PHP_EOL . "Your ionCube Loader extension ({$current}) is incompatible with Phar files." . PHP_EOL;
$text .= 'Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:' . PHP_EOL;
$text .= ' zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so';
$displayIniMessage = true;
//.........这里部分代码省略.........
示例14: test_loader_ioncube
/**
* Check Ioncube Loader version
*/
private function test_loader_ioncube()
{
if (extension_loaded('ionCube Loader') && $this->function_usable('ioncube_loader_version')) {
if (!$this->function_usable('ioncube_loader_iversion')) {
$this->warnings[__METHOD__][] = 'You have a VERY old version of IonCube Loader which is known to cause problems.';
} elseif (ioncube_loader_iversion() < 40400 && version_compare(PHP_VERSION, '5.4') >= 0) {
$this->warnings[__METHOD__][] = 'You have an old version of IonCube Loader (earlier than 4.4.0) which is known to cause problems with PHP 5.4.';
} elseif (ioncube_loader_iversion() < 40007) {
$this->warnings[__METHOD__][] = 'You have an old version of IonCube Loader (earlier than 4.0.7) which is known to cause problems with PHP scripts.';
}
} else {
$this->warnings[__METHOD__][] = 'You do not seem to have IonCube Loader installed.';
}
}
示例15: hasIonCube
/**
* Check whether the ionCube Loader is enabled
*
* @return boolean True if the ionCube Loader is enabled
*/
public function hasIonCube()
{
if (!extension_loaded('ionCube Loader')) {
return false;
}
// The issues have been fixed in version 4.0.9
if (function_exists('ioncube_loader_iversion') && ioncube_loader_iversion() >= 40009) {
return false;
}
$this->available = false;
return true;
}