Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter displays a blank page instead of error messages

I'm using Codeigniter, and instead of error messages I'm just getting a blank page. Is there any way to show PHP error messages instead? It's very hard to debug when I get no feedback.

My environment is Ubuntu with Apache.

like image 439
FlyingCat Avatar asked Mar 06 '12 16:03

FlyingCat


2 Answers

Since none of the solutions seem to be working for you so far, try this one:

ini_set('display_errors', 1); 

http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

This explicitly tells PHP to display the errors. Some environments can have this disabled by default.

This is what my environment settings look like in index.php:

/*  *---------------------------------------------------------------  * APPLICATION ENVIRONMENT  *---------------------------------------------------------------  */ define('ENVIRONMENT', 'development'); /*  *---------------------------------------------------------------  * ERROR REPORTING  *---------------------------------------------------------------  */ if (defined('ENVIRONMENT')) {     switch (ENVIRONMENT)     {         case 'development':             // Report all errors             error_reporting(E_ALL);              // Display errors in output             ini_set('display_errors', 1);         break;          case 'testing':         case 'production':             // Report all errors except E_NOTICE             // This is the default value set in php.ini             error_reporting(E_ALL ^ E_NOTICE);              // Don't display errors (they can still be logged)             ini_set('display_errors', 0);         break;          default:             exit('The application environment is not set correctly.');     } } 
like image 81
Wesley Murch Avatar answered Oct 05 '22 21:10

Wesley Murch


Make sure php5-mysql is installed.

like image 23
alexanderlukanin13 Avatar answered Oct 05 '22 21:10

alexanderlukanin13