Blank Screen with CodeIgniter

后端 未结 7 1678
花落未央
花落未央 2020-12-10 06:58

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

相关标签:
7条回答
  • 2020-12-10 07:28

    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.

    0 讨论(0)
  • 2020-12-10 07:30

    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.

    0 讨论(0)
  • 2020-12-10 07:32

    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

    0 讨论(0)
  • 2020-12-10 07:40

    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

    0 讨论(0)
  • 2020-12-10 07:45

    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.

    0 讨论(0)
  • 2020-12-10 07:46

    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
    0 讨论(0)
提交回复
热议问题