init.php 992 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Configure PHP error reporting.
  4. * @see http://php.net/manual/en/function.error-reporting.php
  5. */
  6. error_reporting(E_ALL | E_STRICT);
  7. /*
  8. * Choose if errors that are NOT caught by the Mako error and exception handlers should be
  9. * printed to the screen as part of the output or if they should be hidden from the user.
  10. * It is recommended to set this value to false when you are in production.
  11. */
  12. ini_set('display_errors', true);
  13. /*
  14. * Override the default path for error logs.
  15. */
  16. ini_set('error_log', __DIR__ . '/storage/logs/error_' . gmdate('Y_m_d') . '.log');
  17. /*
  18. * Convert all errors to ErrorExceptions.
  19. */
  20. set_error_handler(function($code, $message, $file, $line)
  21. {
  22. if((error_reporting() & $code) !== 0)
  23. {
  24. throw new ErrorException($message, $code, $code, $file, $line);
  25. }
  26. return true;
  27. });
  28. /*
  29. * Define some constants.
  30. */
  31. define('MAKO_APPLICATION_PATH', __DIR__);
  32. /**
  33. * Include the composer autoloader.
  34. */
  35. include dirname(__DIR__) . '/vendor/autoload.php';