7

I have currently set my Codeigniter root index.php's environment variable to development.

And I haven't also enabled tiny URL mode.

I don't like to check /var/log/apache2/error.log every night and day!

Want my PHP errors back to the page. 500 Internal error is really the *HARD*est method that can be used to show the error.

Note that we are working on an Ubuntu 12.04 LTS server with default config.

1
  • Perhaps it's not codeigniter, have you checked php.ini for display_errors? Jan 5, 2013 at 14:19

2 Answers 2

15

As mentioned in the comment I'm doubtful that this is CodeIgniter's issue. It's more likely that you simply have display_errors set to off in your php.ini.

If I remember correctly, CI's index.php contains a call to ini_set('error_reporting', ..); to change the default behaviour anyway, so you could always look in there first and see what's going on.

Just had a look, here's the default:

/*
|---------------------------------------------------------------
| PHP ERROR REPORTING LEVEL
|---------------------------------------------------------------
|
| By default CI runs with error reporting set to ALL.  For security
| reasons you are encouraged to change this when your site goes live.
| For more info visit:  http://www.php.net/error_reporting
|
*/
    error_reporting(E_ALL);

If you simply add under there ini_set('display_errors', 1);, it should start working just fine. Obviously the best bet would be to add a switch for your environment to set these variables, I'm not sure why it's not like that already, but here's an example:

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL);
            ini_set('display_errors', 1);
            break;
        case 'production':
            error_reporting(0);
            ini_set('display_errors', 0);
            break;
    }
}
0
1

I had the same problem the only thing i got from codeigniter was only an 500 Internal error.(my old projects and a clean install did the same) But the interesting part is that my non CI projects still worked that contained mostly php.

The tip to write out the error with

ini_set('display_errors', 'On' / ,1)

Solved my problem for some reason i didn't have the rights to read the codeigniter core files.

Adding ' +r ' to the files fixed the problem.

Rudi Visser
CarlosIPe
I Thank you both for the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.