ivantcholakov/starter-public-edition-4

environment and errors reporting

Closed this issue · 4 comments

Hi,
Where can I find file like a in original CI index.php? There were settings which were able to set environment. Is that option still exist?

Its code has been moved in the following file:
https://github.com/ivantcholakov/starter-public-edition-4/blob/master/platform/bootstrap/bootstrap.php
and it is highly modified. I don't see a reason it to be touched.

There is a configuration file environment.php that is called very early by the bootstrap file and there I put some common PHP settings so far.
https://github.com/ivantcholakov/starter-public-edition-4/blob/master/platform/common/config/environment.php
Perhaps it is what you need.

Im rather looking for something like this:

/*
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 *
 * Different environments will require different levels of error reporting.
 * By default development will show errors but testing and live will hide them.
 */
switch (ENVIRONMENT)
{
    case 'development':
        error_reporting(-1);
        ini_set('display_errors', 1);
    break;
    case 'testing':
    case 'production':
        ini_set('display_errors', 0);
        if (version_compare(PHP_VERSION, '5.3', '>='))
        {
            error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
        }
        else
        {
            error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
        }
    break;
    default:
        header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
        echo 'The application environment is not set correctly.';
        exit(1); // EXIT_ERROR
}

yea, its exactly that was im looking for. Thank you very much. :) 👍