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?
问题:
回答1:
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']
toTRUE
- 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
回答2:
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
回答3:
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.
回答4:
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.
回答5:
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.
回答6:
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
回答7:
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.