check.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. require_once dirname(__FILE__).'/SymfonyRequirements.php';
  3. $symfonyRequirements = new SymfonyRequirements();
  4. $iniPath = $symfonyRequirements->getPhpIniConfigPath();
  5. echo "********************************\n";
  6. echo "* *\n";
  7. echo "* Symfony requirements check *\n";
  8. echo "* *\n";
  9. echo "********************************\n\n";
  10. echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
  11. echo "** ATTENTION **\n";
  12. echo "* The PHP CLI can use a different php.ini file\n";
  13. echo "* than the one used with your web server.\n";
  14. if ('\\' == DIRECTORY_SEPARATOR) {
  15. echo "* (especially on the Windows platform)\n";
  16. }
  17. echo "* To be on the safe side, please also launch the requirements check\n";
  18. echo "* from your web server using the web/config.php script.\n";
  19. echo_title('Mandatory requirements');
  20. foreach ($symfonyRequirements->getRequirements() as $req) {
  21. echo_requirement($req);
  22. }
  23. echo_title('Optional recommendations');
  24. foreach ($symfonyRequirements->getRecommendations() as $req) {
  25. echo_requirement($req);
  26. }
  27. /**
  28. * Prints a Requirement instance
  29. */
  30. function echo_requirement(Requirement $requirement)
  31. {
  32. $result = $requirement->isFulfilled() ? 'OK' : ($requirement->isOptional() ? 'WARNING' : 'ERROR');
  33. echo ' ' . str_pad($result, 9);
  34. echo $requirement->getTestMessage() . "\n";
  35. if (!$requirement->isFulfilled()) {
  36. echo sprintf(" %s\n\n", $requirement->getHelpText());
  37. }
  38. }
  39. function echo_title($title)
  40. {
  41. echo "\n** $title **\n\n";
  42. }