requirements.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * Application requirement checker script.
  4. *
  5. * In order to run this script use the following console command:
  6. * php requirements.php
  7. *
  8. * In order to run this script from the web, you should copy it to the web root.
  9. * If you are using Linux you can create a hard link instead, using the following command:
  10. * ln requirements.php ../requirements.php
  11. */
  12. // you may need to adjust this path to the correct Yii framework path
  13. $frameworkPath = dirname(__FILE__) . '/../../yii';
  14. require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
  15. $requirementsChecker = new YiiRequirementChecker();
  16. /**
  17. * Adjust requirements according to your application specifics.
  18. */
  19. $requirements = array(
  20. // Database :
  21. array(
  22. 'name' => 'PDO extension',
  23. 'mandatory' => true,
  24. 'condition' => extension_loaded('pdo'),
  25. 'by' => 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>',
  26. ),
  27. array(
  28. 'name' => 'PDO SQLite extension',
  29. 'mandatory' => false,
  30. 'condition' => extension_loaded('pdo_sqlite'),
  31. 'by' => 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>',
  32. 'memo' => 'Required for SQLite database.',
  33. ),
  34. array(
  35. 'name' => 'PDO MySQL extension',
  36. 'mandatory' => false,
  37. 'condition' => extension_loaded('pdo_mysql'),
  38. 'by' => 'All <a href="http://www.yiiframework.com/doc/api/#system.db">DB-related classes</a>',
  39. 'memo' => 'Required for MySQL database.',
  40. ),
  41. // Cache :
  42. array(
  43. 'name' => 'Memcache extension',
  44. 'mandatory' => false,
  45. 'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
  46. 'by' => '<a href="http://www.yiiframework.com/doc/api/CMemCache">CMemCache</a>',
  47. 'memo' => extension_loaded('memcached') ? 'To use memcached set <a href="http://www.yiiframework.com/doc/api/CMemCache#useMemcached-detail">CMemCache::useMemcached</a> to <code>true</code>.' : ''
  48. ),
  49. array(
  50. 'name' => 'APC extension',
  51. 'mandatory' => false,
  52. 'condition' => extension_loaded('apc') || extension_loaded('apc'),
  53. 'by' => '<a href="http://www.yiiframework.com/doc/api/CApcCache">CApcCache</a>',
  54. ),
  55. // Additional PHP extensions :
  56. array(
  57. 'name' => 'Mcrypt extension',
  58. 'mandatory' => false,
  59. 'condition' => extension_loaded('mcrypt'),
  60. 'by' => '<a href="http://www.yiiframework.com/doc/api/CSecurityManager">CSecurityManager</a>',
  61. 'memo' => 'Required by encrypt and decrypt methods.'
  62. ),
  63. // PHP ini :
  64. 'phpSafeMode' => array(
  65. 'name' => 'PHP safe mode',
  66. 'mandatory' => false,
  67. 'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
  68. 'by' => 'File uploading and console command execution',
  69. 'memo' => '"safe_mode" should be disabled at php.ini',
  70. ),
  71. 'phpExposePhp' => array(
  72. 'name' => 'Expose PHP',
  73. 'mandatory' => false,
  74. 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
  75. 'by' => 'Security reasons',
  76. 'memo' => '"expose_php" should be disabled at php.ini',
  77. ),
  78. 'phpAllowUrlInclude' => array(
  79. 'name' => 'PHP allow url include',
  80. 'mandatory' => false,
  81. 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
  82. 'by' => 'Security reasons',
  83. 'memo' => '"allow_url_include" should be disabled at php.ini',
  84. ),
  85. 'phpSmtp' => array(
  86. 'name' => 'PHP mail SMTP',
  87. 'mandatory' => false,
  88. 'condition' => strlen(ini_get('SMTP'))>0,
  89. 'by' => 'Email sending',
  90. 'memo' => 'PHP mail SMTP server required',
  91. ),
  92. );
  93. $requirementsChecker->checkYii()->check($requirements)->render();