Skip to content

Commit

Permalink
ENHANCEMENT: Change PHP version requirements. Part of #7131.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Curry committed Apr 13, 2012
1 parent 0fd7ce6 commit 8b0dafb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
9 changes: 3 additions & 6 deletions dev/install/install.php
Expand Up @@ -4,19 +4,16 @@
************************************************************************************
** **
** If you can read this text in your browser then you don't have PHP installed. **
** Please install PHP 5.3 or higher. **
** Please install PHP 5.3.2 or higher, preferably PHP 5.3.10. **
** **
************************************************************************************
************************************************************************************/

/**
* PHP version check. Make sure we've got at least PHP 5.3 in the most friendly way possible
* PHP version check. Make sure we've got at least PHP 5.3.2 in the most friendly way possible
*/

$majorVersion = strtok(phpversion(),'.');
$minorVersion = strtok('.');

if($majorVersion < 5 || ($majorVersion == 5 && $minorVersion < 3)) {
if (version_compare(phpversion(), '5.3.2', '<')) {
header("HTTP/1.1 500 Server Error");
echo str_replace('$PHPVersion', phpversion(), file_get_contents("sapphire/dev/install/php5-required.html"));
die();
Expand Down
4 changes: 2 additions & 2 deletions dev/install/install.php5
Expand Up @@ -4,7 +4,7 @@
************************************************************************************
** **
** If you can read this text in your browser then you don't have PHP installed. **
** Please install PHP 5.3 or higher. **
** Please install PHP 5.3.2 or higher, preferably PHP 5.3.10. **
** **
************************************************************************************
************************************************************************************/
Expand Down Expand Up @@ -325,7 +325,7 @@ class InstallRequirements {
$isIIS = $this->isIIS(7);
$webserver = $this->findWebserver();

$this->requirePHPVersion('5.3.0', '5.2.0', array("PHP Configuration", "PHP5 installed", null, "PHP version " . phpversion()));
$this->requirePHPVersion('5.3.10', '5.3.2', array("PHP Configuration", "PHP5 installed", null, "PHP version " . phpversion()));

// Check that we can identify the root folder successfully
$this->requireFile('sapphire/dev/install/config-form.html', array("File permissions",
Expand Down
10 changes: 5 additions & 5 deletions dev/install/php5-required.html
@@ -1,18 +1,18 @@
<html>
<head>
<title>PHP 5.3 is required</title>
<title>PHP 5.3.2 is required</title>
<link rel="stylesheet" type="text/css" href="sapphire/dev/install/css/install.css">
</head>
<body>
<div id="BgContainer">
<div id="Container">
<div id="Header">
<h1>PHP 5.3 required</h1>
<h1>PHP 5.3.2 required</h1>
<div class="left">
<h3>To run SilverStripe, please install PHP 5.3 or greater.</h3>
<h3>To run SilverStripe, please install PHP 5.3.2 or greater.</h3>

<p>We have detected that you are running PHP version <b>$PHPVersion</b>. In order to run SilverStripe,
you must have PHP version 5.3 or greater, and for best results we recommend PHP 5.3.8 or greater.<p/>
<p>We have detected that you are running PHP version <b>$PHPVersion</b>. In order to run SilverStripe,
you must have PHP version 5.3.2 or greater, and for best results we recommend PHP 5.3.10 or greater.<p/>

<p>If you are running on a shared host, you may need to ask your hosting provider how to do this.</p>
</div>
Expand Down
6 changes: 2 additions & 4 deletions main.php
Expand Up @@ -4,7 +4,7 @@
************************************************************************************
** **
** If you can read this text in your browser then you don't have PHP installed. **
** Please install PHP 5.3 or higher. **
** Please install PHP 5.3.2 or higher, preferably PHP 5.3.10. **
** **
************************************************************************************
************************************************************************************/
Expand All @@ -13,10 +13,8 @@
* @package sapphire
* @subpackage core
*/
$majorVersion = strtok(phpversion(),'.');
$minorVersion = strtok('.');

if($majorVersion < 5 || ($majorVersion == 5 && $minorVersion < 3)) {
if (version_compare(phpversion(), '5.3.2', '<')) {
header("HTTP/1.1 500 Server Error");
echo str_replace('$PHPVersion', phpversion(), file_get_contents("dev/install/php5-required.html"));
die();
Expand Down

0 comments on commit 8b0dafb

Please sign in to comment.