Skip to content

Instantly share code, notes, and snippets.

@fahdi
Created January 6, 2015 13:17
Show Gist options
  • Save fahdi/72a3e20d7108c1054251 to your computer and use it in GitHub Desktop.
Save fahdi/72a3e20d7108c1054251 to your computer and use it in GitHub Desktop.
Error reporting: Optionally, when using Apache, you can use the APPLICATION_ENV setting in your VirtualHost to let PHP output all its errors to the browser. This can be useful during the development of your application. Edit index.php from the zf2-tutorial/public/ directory and change it to the following:
<?php
/**
* Display all errors when APPLICATION_ENV is development.
*/
if ($_SERVER['APPLICATION_ENV'] == 'development') { error_reporting(E_ALL); ini_set("display_errors", 1);
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL))) return false;
}
// Setup autoloading
require 'init_autoloader.php'; // Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment