Codeigniter blank page and error 500 in apache log?
Posting this, just in case it helps somebody...
If you are on a shared hosting platform and do not have access to directories other than where you are supposed to host your files: the trick was to force php to throw all errors even if apache could not.
Open "index.php" that resides in the root folder of your codeigniter installation;
define('ENVIRONMENT', 'development');
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
case 'development':
error_reporting(E_ALL);
/*added line below*/
ini_set('display_errors', '1');
break;
......
Making the above change immediately started displaying what was wrong with the code and I was able to fix it and get it up and running.
Don't forget to set your codeigniter environment to "production" once you're done fixing it.
I finally found something that pointed me in the right direction. These two posts mentioned how CI uses the @ in the database module might be causing that issue.
php return 500 error but no error log
CodeIgniter project loads blank webpage
I disabled auto-loading the database module and the site works. Now I just have to figure out the database error I was getting that might be causing CI to fail. I'll update this answer once I figure it out.
Update: I checked the account/password and access for the database everything was working. The issue was the php mysql driver was not installed. This is my first time really using an Ubuntu system and I thought that the mysql driver would be installed with the default php package, which I was incorrect about.
After installing php5-mysqlnd and enabling the database library in CI's autoload everything works properly now. The fact that I was not getting any errors is really making me consider changing frameworks.
Here is another reason why errors might not be visible:
I had the same issue. In my case, I had copied the source from a production environment. Hence the ENVIRONMENT
variable defined in index.php
was set to 'production'
. This caused error_reporting
to be set to 0 (no logging). Just set it to 'development'
and you should start seeing error messages in apache log.
Turned out the 500 was due to a semi colon missing in database config :-)