7

I've just moved a site across to a production server, and a once working CodeIgniter installation now returns a blank screen. I believe it is due to whitespace, but how are you supposed to find something like that?

Jonathan Leffler
  • 666,971
  • 126
  • 813
  • 1,185
Tisch
  • 2,508
  • 4
  • 27
  • 34

7 Answers7

11

Things to check:

  • Inside config.php, make sure your $config['base_url'] is set properly
  • Were you able to copy your .htaccess as well?
  • Do you have the same PHP versions in both machines? If your answer is yes, i'll ask you again: Are you sure?
  • What is the value of your $db['default']['hostname']?
  • Do you have the same database setup in your local and production server? There could be differences with the hostname, username, password and database name

Other things you can do:

  • Set $db['default']['db_debug'] to TRUE
  • Deploy a fresh CodeIgniter installation in your production server and check if you can see something
  • If you still see a blank page, deploy a single PHP file with text in it and tell us what you see
Randell
  • 5,856
  • 5
  • 42
  • 69
  • turns out that the server is running PHP 4 instead of 5. Hopefully the hosting company will update it for me tomorrow. Thanks for replying. – Tisch Aug 11 '09 at 20:12
  • @randell my app is on CI and run on heroku server .Index.php is echo "Hello" but my default controller is nor running .and i am not sure about the php version of heroku and my app(CI='2.1.2',PHP=5.5.16) – HaRsH Aug 30 '14 at 09:31
  • 2
    @HaRsH, make sure that `display_errors` and `display_startup_errors` are set to `true`. Also make sure that `error_reporting` is set to `E_ALL`. See http://stackoverflow.com/a/21429652/106778 for example. – Randell Aug 31 '14 at 11:09
  • @Randell Thanks for your answer... There is problem of MYSQL Ext. I install that bu composer on Heroku server so every thing is working fine ... :) – HaRsH Sep 02 '14 at 10:45
10

The issue may be due to missing the php module 'mysqli'. This is the driver to your calling on the database. I would check that with:

php -i | grep mysqli

php -m

rlane
  • 101
  • 1
  • 2
  • This has solved my problem twice now. CodeIgnitor will blank screen if PHP doesnt have the appropriate database extension installed – Erin Drummond Dec 09 '12 at 10:01
  • This solved my problem as well, thanks @rlane. There were no errors even in the apache2 logs to indicate this was an issue... – Jarrett Sep 19 '13 at 18:58
  • Thank you. This was my problem while hosting on Heroku. I had to update composer.json to include `"ext-mysql": "*"` under the `"require"` section, then run `composer update` to update composer.lock file. – Tod Birdsall Aug 07 '15 at 14:10
  • On Debian the package name is php5-mysql. – wieczorek1990 Nov 10 '15 at 10:42
7

I experienced the same issue and I solved it by setting my log-folder to writable. It seems, that if you turn on logging, and your log-folder on your server is not writable, CodeIgniter just shows you an empty page.

Pascal Klein
  • 20,294
  • 23
  • 79
  • 118
  • 2
    You just rescued me from 3 hours of hunting. we really need to check the write-ability of that directory. – Eric Cope Nov 22 '11 at 01:54
1

Load your url helper when you create a function, eg:

visibility function_name () 
{
    $this->load->helper('url');

}

It will show you errors or a view you loaded.

Robert
  • 5,191
  • 43
  • 59
  • 113
BK004
  • 382
  • 2
  • 10
0

I have simillar problem. I try all possible way that people wrote. But no one work for me. But, finnaly i found that my index.php is not complete when transfer to server via ftp. So, if anyone still can't solve white screen of death may your index.php is not complete.

0

If you've moved to a new server ensure the server has PHP-5 installed on it. The reason why the screen is blank is because the server cannot render PHP yet.

Type this line in and restart after:

sudo apt-get install php5 libapache2-mod-php5

To restart:

sudo service apache2 restart

This is of course assuming you have access to the server via an SSH client with admin rights.

best of luck, Niall

Niall Lonergan
  • 780
  • 1
  • 6
  • 25
0

Declare this somewhere in your /index.php file:

function exception_handler($exception) {
    echo "Uncaught exception: " . $exception->getMessage();
}

set_exception_handler('exception_handler');

It seems CodeIgniter (v2?) only handles exceptions that are derived from CI_Exception, so any uncaught exceptions (from third party libraries, etc) are not handled.