简体   繁体   中英

Codeigniter blank page when load database

So after while searching into stackoverflow, decide to write this question.

I'm working this time on Godaddy's hosting cPanel plan. Uploaded a clean package of Codeigniter V 2.2.6 and the welcome message shows as it should. I configured config.php with url and database.php with the correct connection data. Until now, everything work as it should. So after that load database to see if everything goes bien and the "blank screen of dead" appears if I refresh the page.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *      http://example.com/index.php/welcome
     *  - or -  
     *      http://example.com/index.php/welcome/index
     *  - or -
     * Since this controller is set as the default controller in 
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see http://codeigniter.com/user_guide/general/urls.html
     */
    public function index()
    {
        $this->load->database();
        $this->load->view('welcome_message');
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

So after searching where it breaks, I found inside /system/core/Codeigniter.php in lines 300. Break before $CI = new $class();

/*
 * ------------------------------------------------------
 *  Instantiate the requested controller
 * ------------------------------------------------------
 */
    // Mark a start point so we can benchmark the controller
    $BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
    $CI = new $class();

And Inside the log files, returned this lines

DEBUG - 2015-11-19 20:57:31 --> Config Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Hooks Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Utf8 Class Initialized
DEBUG - 2015-11-19 20:57:31 --> UTF-8 Support Enabled
DEBUG - 2015-11-19 20:57:31 --> URI Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Router Class Initialized
DEBUG - 2015-11-19 20:57:31 --> No URI present. Default controller set.
DEBUG - 2015-11-19 20:57:31 --> Output Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Security Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Input Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Global POST and COOKIE data sanitized
DEBUG - 2015-11-19 20:57:31 --> Language Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Loader Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: url_helper
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: html_helper
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: cms_helper
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: drops_helper
DEBUG - 2015-11-19 20:57:31 --> Controller Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Model Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Model Class Initialized
DEBUG - 2015-11-19 20:57:31 --> Helper loaded: form_helper
DEBUG - 2015-11-19 20:57:31 --> Database Driver Class Initialized

I need to deploy a web made in other server and when I uploaded inside Godaddy the blank page appears, that's the reason why I upload a clean package of Codeigniter. Anyone can help me? Thanks in advance.


EDIT Forgot to write the error report on index.php

define('ENVIRONMENT', 'development');

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            ini_set('display_errors',1);
            error_reporting(E_ALL);
        break;

        case 'testing':
        case 'production':
            error_reporting(0);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}

Load database Library in application/config/autoload.php like follows:

$autoload['libraries'] = array('database');

Remove following line from your file:

$this->load->database();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM