Permalink
Browse files

Show response for URL rewriting check so debugging easier

  • Loading branch information...
1 parent b200d6d commit 6de62008cc9db982c11e36afc0cc51aeb406ff8a @halkyon committed Nov 29, 2010
Showing with 30 additions and 19 deletions.
  1. +29 −18 index.php
  2. +1 −1 rewritetest/test.php
View
@@ -5,13 +5,19 @@
* Checks that the server environment meets minimum requirements for running
* SilverStripe (http://silverstripe.org).
*
- * @todo Provide recommendations for assertions that fail
+ * Tested in the following environments:
*
- * Has been tested on the following environments:
- * - Windows 7 x64: Apache 2.2.17 (mod_php5), PHP 5.3.4 RC1
- * - Mac OS X 10.6.5: Apache 2.2.17 (mod_php5), PHP 5.3.3
+ * - Windows 7 x64: Apache 2.2.17 (mod_php5), PHP 5.3.3 VC9 TS
+ * - Windows Server 2008 R2 Standard: IIS 7.5 (FastCGI), PHP 5.3.3 VC9 NTS
+ * - Mac OS X 10.6.5 (MacPorts): Apache 2.2.17 (mod_php5), PHP 5.3.3
* - Debian 5 "lenny": Apache 2.2.9 (mod_php5), PHP 5.2.6
* - Ubuntu Server 10.10: Apache 2.2.16 (mod_php5), PHP 5.3.3
+ * - Arvixe Red Hat Linux: Apache 2.2.16 (FastCGI), PHP 5.2.14
+ * @todo URL rewrite check fails for some reason on Arvixe.
+ * This is a broken check, as there is a permission problem.
+ *
+ * @todo Provide recommendations for assertions that fail
+ * @todo Display single value assertions e.g. "Off" not "On" as a table with actual versus recommended values
*
* @package ssreqcheck
* @author Sean Harvey <sean at silverstripe dot com>
@@ -229,18 +235,7 @@ public function assertPhpDateTimezoneSetAndValid() {
return ini_get('date.timezone') && in_array(ini_get('date.timezone'), timezone_identifiers_list());
}
- /**
- * Determine if URL rewriting support is working on the webserver.
- *
- * Rather than doing specific checks for Apache or IIS, this method will
- * check the response of a specific test URL in order to make a determination
- * of URL rewriting is working or not.
- *
- * @todo This doesn't work when PHP is running in CLI.
- *
- * @return boolean TRUE passed assertion | FALSE failed assertion
- */
- public function assertWebserverUrlRewritingSupport() {
+ public function getWebserverUrlRewritingResponse() {
if(function_exists('curl_init')) {
$ch = curl_init();
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
@@ -250,12 +245,28 @@ public function assertWebserverUrlRewritingSupport() {
$response = curl_exec($ch);
curl_close($ch);
- return preg_match('/test.php queryval: testvalue/', $response);
+ return $response;
} else {
return false;
}
}
+ /**
+ * Determine if URL rewriting support is working on the webserver.
+ *
+ * Rather than doing specific checks for Apache or IIS, this method will
+ * check the response of a specific test URL in order to make a determination
+ * of URL rewriting is working or not.
+ *
+ * @todo This doesn't work when PHP is running in CLI.
+ *
+ * @return boolean TRUE passed assertion | FALSE failed assertion
+ */
+ public function assertWebserverUrlRewritingSupport() {
+ $response = $this->getWebserverUrlRewritingResponse();
+ return ($response) ? preg_match('/test.php queryval: testvalue/', $response) : false;
+ }
+
}
/**
* Simple abstraction class which formats text based on whether PHP is running
@@ -355,7 +366,7 @@ public function nl() {
echo $f->nl();
echo $f->heading('Webserver configuration', 2);
-echo $f->showAssertion('URL rewrite support', $r->assertWebserverUrlRewritingSupport(), '', false);
+echo $f->showAssertion('URL rewrite support', $r->assertWebserverUrlRewritingSupport(), $r->getWebserverUrlRewritingResponse(), false);
echo $f->nl();
echo $f->heading('PHP configuration', 2);
View
@@ -1,2 +1,2 @@
<?php
-echo __FILE__ . ' queryval: ' . $_GET['testquery'];
+echo 'OK: ' . __FILE__ . ' queryval: ' . $_GET['testquery'];

0 comments on commit 6de6200

Please sign in to comment.