install.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <?php
  2. // Sanity check, install should only be checked from index.php
  3. defined('SYSPATH') or exit('Install tests must be loaded from within index.php!');
  4. if (version_compare(PHP_VERSION, '5.3', '<'))
  5. {
  6. // Clear out the cache to prevent errors. This typically happens on Windows/FastCGI.
  7. clearstatcache();
  8. }
  9. else
  10. {
  11. // Clearing the realpath() cache is only possible PHP 5.3+
  12. clearstatcache(TRUE);
  13. }
  14. ?>
  15. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  16. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  17. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  20. <title>Kohana Installation</title>
  21. <style type="text/css">
  22. body { width: 42em; margin: 0 auto; font-family: sans-serif; background: #fff; font-size: 1em; }
  23. h1 { letter-spacing: -0.04em; }
  24. h1 + p { margin: 0 0 2em; color: #333; font-size: 90%; font-style: italic; }
  25. code { font-family: monaco, monospace; }
  26. table { border-collapse: collapse; width: 100%; }
  27. table th,
  28. table td { padding: 0.4em; text-align: left; vertical-align: top; }
  29. table th { width: 12em; font-weight: normal; }
  30. table tr:nth-child(odd) { background: #eee; }
  31. table td.pass { color: #191; }
  32. table td.fail { color: #911; }
  33. #results { padding: 0.8em; color: #fff; font-size: 1.5em; }
  34. #results.pass { background: #191; }
  35. #results.fail { background: #911; }
  36. </style>
  37. </head>
  38. <body>
  39. <h1>Environment Tests</h1>
  40. <p>
  41. The following tests have been run to determine if <a href="http://kohanaframework.org/">Kohana</a> will work in your environment.
  42. If any of the tests have failed, consult the <a href="http://kohanaframework.org/guide/about.install">documentation</a>
  43. for more information on how to correct the problem.
  44. </p>
  45. <?php $failed = FALSE ?>
  46. <table cellspacing="0">
  47. <tr>
  48. <th>PHP Version</th>
  49. <?php if (version_compare(PHP_VERSION, '5.3.3', '>=')): ?>
  50. <td class="pass"><?php echo PHP_VERSION ?></td>
  51. <?php else: $failed = TRUE ?>
  52. <td class="fail">Kohana requires PHP 5.3.3 or newer, this version is <?php echo PHP_VERSION ?>.</td>
  53. <?php endif ?>
  54. </tr>
  55. <tr>
  56. <th>System Directory</th>
  57. <?php if (is_dir(SYSPATH) AND is_file(SYSPATH.'classes/Kohana'.EXT)): ?>
  58. <td class="pass"><?php echo SYSPATH ?></td>
  59. <?php else: $failed = TRUE ?>
  60. <td class="fail">The configured <code>system</code> directory does not exist or does not contain required files.</td>
  61. <?php endif ?>
  62. </tr>
  63. <tr>
  64. <th>Application Directory</th>
  65. <?php if (is_dir(APPPATH) AND is_file(APPPATH.'bootstrap'.EXT)): ?>
  66. <td class="pass"><?php echo APPPATH ?></td>
  67. <?php else: $failed = TRUE ?>
  68. <td class="fail">The configured <code>application</code> directory does not exist or does not contain required files.</td>
  69. <?php endif ?>
  70. </tr>
  71. <tr>
  72. <th>Cache Directory</th>
  73. <?php if (is_dir(APPPATH) AND is_dir(APPPATH.'cache') AND is_writable(APPPATH.'cache')): ?>
  74. <td class="pass"><?php echo APPPATH.'cache/' ?></td>
  75. <?php else: $failed = TRUE ?>
  76. <td class="fail">The <code><?php echo APPPATH.'cache/' ?></code> directory is not writable.</td>
  77. <?php endif ?>
  78. </tr>
  79. <tr>
  80. <th>Logs Directory</th>
  81. <?php if (is_dir(APPPATH) AND is_dir(APPPATH.'logs') AND is_writable(APPPATH.'logs')): ?>
  82. <td class="pass"><?php echo APPPATH.'logs/' ?></td>
  83. <?php else: $failed = TRUE ?>
  84. <td class="fail">The <code><?php echo APPPATH.'logs/' ?></code> directory is not writable.</td>
  85. <?php endif ?>
  86. </tr>
  87. <tr>
  88. <th>PCRE UTF-8</th>
  89. <?php if ( ! @preg_match('/^.$/u', 'ñ')): $failed = TRUE ?>
  90. <td class="fail"><a href="http://php.net/pcre">PCRE</a> has not been compiled with UTF-8 support.</td>
  91. <?php elseif ( ! @preg_match('/^\pL$/u', 'ñ')): $failed = TRUE ?>
  92. <td class="fail"><a href="http://php.net/pcre">PCRE</a> has not been compiled with Unicode property support.</td>
  93. <?php else: ?>
  94. <td class="pass">Pass</td>
  95. <?php endif ?>
  96. </tr>
  97. <tr>
  98. <th>SPL Enabled</th>
  99. <?php if (function_exists('spl_autoload_register')): ?>
  100. <td class="pass">Pass</td>
  101. <?php else: $failed = TRUE ?>
  102. <td class="fail">PHP <a href="http://www.php.net/spl">SPL</a> is either not loaded or not compiled in.</td>
  103. <?php endif ?>
  104. </tr>
  105. <tr>
  106. <th>Reflection Enabled</th>
  107. <?php if (class_exists('ReflectionClass')): ?>
  108. <td class="pass">Pass</td>
  109. <?php else: $failed = TRUE ?>
  110. <td class="fail">PHP <a href="http://www.php.net/reflection">reflection</a> is either not loaded or not compiled in.</td>
  111. <?php endif ?>
  112. </tr>
  113. <tr>
  114. <th>Filters Enabled</th>
  115. <?php if (function_exists('filter_list')): ?>
  116. <td class="pass">Pass</td>
  117. <?php else: $failed = TRUE ?>
  118. <td class="fail">The <a href="http://www.php.net/filter">filter</a> extension is either not loaded or not compiled in.</td>
  119. <?php endif ?>
  120. </tr>
  121. <tr>
  122. <th>Iconv Extension Loaded</th>
  123. <?php if (extension_loaded('iconv')): ?>
  124. <td class="pass">Pass</td>
  125. <?php else: $failed = TRUE ?>
  126. <td class="fail">The <a href="http://php.net/iconv">iconv</a> extension is not loaded.</td>
  127. <?php endif ?>
  128. </tr>
  129. <?php if (extension_loaded('mbstring')): ?>
  130. <tr>
  131. <th>Mbstring Not Overloaded</th>
  132. <?php if (ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING): $failed = TRUE ?>
  133. <td class="fail">The <a href="http://php.net/mbstring">mbstring</a> extension is overloading PHP's native string functions.</td>
  134. <?php else: ?>
  135. <td class="pass">Pass</td>
  136. <?php endif ?>
  137. </tr>
  138. <?php endif ?>
  139. <tr>
  140. <th>Character Type (CTYPE) Extension</th>
  141. <?php if ( ! function_exists('ctype_digit')): $failed = TRUE ?>
  142. <td class="fail">The <a href="http://php.net/ctype">ctype</a> extension is not enabled.</td>
  143. <?php else: ?>
  144. <td class="pass">Pass</td>
  145. <?php endif ?>
  146. </tr>
  147. <tr>
  148. <th>URI Determination</th>
  149. <?php if (isset($_SERVER['REQUEST_URI']) OR isset($_SERVER['PHP_SELF']) OR isset($_SERVER['PATH_INFO'])): ?>
  150. <td class="pass">Pass</td>
  151. <?php else: $failed = TRUE ?>
  152. <td class="fail">Neither <code>$_SERVER['REQUEST_URI']</code>, <code>$_SERVER['PHP_SELF']</code>, or <code>$_SERVER['PATH_INFO']</code> is available.</td>
  153. <?php endif ?>
  154. </tr>
  155. </table>
  156. <?php if ($failed === TRUE): ?>
  157. <p id="results" class="fail">✘ Kohana may not work correctly with your environment.</p>
  158. <?php else: ?>
  159. <p id="results" class="pass">✔ Your environment passed all requirements.<br />
  160. Remove or rename the <code>install<?php echo EXT ?></code> file now.</p>
  161. <?php endif ?>
  162. <h1>Optional Tests</h1>
  163. <p>
  164. The following extensions are not required to run the Kohana core, but if enabled can provide access to additional classes.
  165. </p>
  166. <table cellspacing="0">
  167. <tr>
  168. <th>PECL HTTP Enabled</th>
  169. <?php if (extension_loaded('http')): ?>
  170. <td class="pass">Pass</td>
  171. <?php else: ?>
  172. <td class="fail">Kohana can use the <a href="http://php.net/http">http</a> extension for the Request_Client_External class.</td>
  173. <?php endif ?>
  174. </tr>
  175. <tr>
  176. <th>cURL Enabled</th>
  177. <?php if (extension_loaded('curl')): ?>
  178. <td class="pass">Pass</td>
  179. <?php else: ?>
  180. <td class="fail">Kohana can use the <a href="http://php.net/curl">cURL</a> extension for the Request_Client_External class.</td>
  181. <?php endif ?>
  182. </tr>
  183. <tr>
  184. <th>mcrypt Enabled</th>
  185. <?php if (extension_loaded('mcrypt')): ?>
  186. <td class="pass">Pass</td>
  187. <?php else: ?>
  188. <td class="fail">Kohana requires <a href="http://php.net/mcrypt">mcrypt</a> for the Encrypt class.</td>
  189. <?php endif ?>
  190. </tr>
  191. <tr>
  192. <th>GD Enabled</th>
  193. <?php if (function_exists('gd_info')): ?>
  194. <td class="pass">Pass</td>
  195. <?php else: ?>
  196. <td class="fail">Kohana requires <a href="http://php.net/gd">GD</a> v2 for the Image class.</td>
  197. <?php endif ?>
  198. </tr>
  199. <tr>
  200. <th>MySQL Enabled</th>
  201. <?php if (function_exists('mysql_connect')): ?>
  202. <td class="pass">Pass</td>
  203. <?php else: ?>
  204. <td class="fail">Kohana can use the <a href="http://php.net/mysql">MySQL</a> extension to support MySQL databases.</td>
  205. <?php endif ?>
  206. </tr>
  207. <tr>
  208. <th>PDO Enabled</th>
  209. <?php if (class_exists('PDO')): ?>
  210. <td class="pass">Pass</td>
  211. <?php else: ?>
  212. <td class="fail">Kohana can use <a href="http://php.net/pdo">PDO</a> to support additional databases.</td>
  213. <?php endif ?>
  214. </tr>
  215. </table>
  216. </body>
  217. </html>