我刚刚找到了所需的代码段。
<?php
class
RedSparkInstaller_RsModule_Installer_Model_Dataobject_Requirement_PHPVersion
extends
RedSparkInstaller_RsModule_Installer_Model_Dataobject_Requirement
{
/**
* Constructor inits the requirement.
*
* Check the requirements automatically.
*/
public function __construct($options = Array()) {
parent::__construct($options);
// PHP version is strictly required
$this->_optional = false;
// Check php Version
$ver = explode('.',PHP_VERSION);
// Note on old, unsupported versions.
$this->_description = sprintf('It is hardly recommended to use an up-to-date version of PHP (5.3.8 or later). Beside security reasons, there are some known, unfixed bugs in older versions.');
// Not 5.2 or 5.3
if ($ver[0] != 5 || $ver[1] < 2 || $ver[1] > 3) {
$this->_found = false;
$this->_notfoundtext = 'You need to install PHP in Version >= 5.2.x or 5.3.x. Your Version is '.PHP_VERSION;
// An old version of 5.3
} else if ($ver[1]==3 && $ver[2] <= 4) {
$this->_notfoundtext = sprintf('PHP %s', PHP_VERSION);
$this->_optional = true;
$this->_found = false;
} else {
$this->_notfoundtext = sprintf('PHP %s', PHP_VERSION);
$this->_found = true;
}
}
}
我从<?php echo$req->getStatusText() ?>
完整的代码如下所示
<table>
<colgroup>
<col width="*">
<col width="50">
<col width="150">
</colgroup>
<tr>
<th>Name</th>
<th>Status</th>
<th></th>
</tr>
<?php foreach($this->requirements AS $req): ?>
<tr>
<td><a href="#" class="open arrow"><?php echo $req->getName(); ?></a></td>
<td class="center">
<?php
switch($req->getStatus()) {
case 0: echo '<img src="/templates/installer/img/icons/cross.png" title="Missing">'; break;
case 1: echo '<img src="/templates/installer/img/icons/tick.png" title="OK">'; break;
case 2: echo '<img src="/templates/installer/img/icons/bullet_orange.png" title="Missing, but optional">'; break;
}
?>
</td>
<td><?php echo$req->getStatusText() ?></td>
</tr>
<tr class="hidden">
<td class="description"><?php echo $req->getDescription(); ?></td>
<td colspan="2"> </td>
</tr>
<?php endforeach; ?>
</table>
当我尝试安装php应用程序时,它会给我错误消息
You need to install PHP in Version >= 5.2.x or 5.3.x. Your Version is 5.5.11
在Bootstrap.php文件中我找到了php版本检查逻辑。
/**
* Check that PHP is installed at least in Version 5.2.x
* Throw exception if not
*/
protected function checkRequirements() {
/* skip check in live systems */
if (config_site_is_live) {
return;
}
/* Check php Version */
$ver = explode('.',PHP_VERSION);
if ($ver[0] < 5 || $ver[1] < 2) {
throw new Exception('You need to install PHP in Version >= 5.2. Your Version is '.phpversion());
}
/* Check PDO */
$pdo = phpversion('PDO');
$pdo_mysql = phpversion('pdo_mysql');
if (!$pdo || !$pdo_mysql) {
throw new Exception('You need to install the PDO and pdo_mysql extension');
}
/* Check simplexml */
$xml = phpversion('simplexml');
if (!$xml) {
throw new Exception('You need to install the simplexml extension');
}
/* Check fileinfo */
$finfo = function_exists('finfo_file');
if (!$finfo) {
#throw new Exception('You need to install the fileinfo extension');
}
/* Check gd */
$gd = function_exists('ImageCreateTrueColor');
if (!$gd) {
throw new Exception('You need to install the gd extension');
}
/* Check mbstring */
$mb = function_exists('mb_strlen');
if (!$mb) {
throw new Exception('You need to install the mbstring extension');
}
/* Safe mode must be switched off */
$safe = ini_get('safe_mode');
if ($safe) {
throw new Exception('safe_mode must be switched off in your php.ini');
}
/* open_basedir mode must be switched off */
$safe = ini_get('open_basedir');
if ($safe) {
throw new Exception('open_basedir must be switched off in your php.ini');
}
}
/**
* Check that PHP is installed at least in Version 5.2.x
* Throw exception if not
*/
我曾试图操纵上面的代码,但我无法安装该应用。你能告诉我怎么做吗?