Question

I'm trying to work locally on my mac with the Mamp software and have a fresh install of Codeigniter set up in a subdirectory of my sites folder and when I try and load my Home controller I'm not getting any errors or have anything being displayed on the screen and I'm trying to find out why that could be.

- Documents
    -Sites
        -mysite
            -application
                -controllers
                    home.php

I'm started the apache and mysql servers and went to http://localhost/mysite/ . The default controller that I have set up in the routes is home and I'm getting a white screen. This is the following code I have inside the home controller.

<?php

class Home extends CI_Controller {
    public function __construct() {
        parent::__construct();
    }

    public function index() {
        public $data = array();
        echo 'this is the index function';
        //$this->load->view('homepage', $data, TRUE);
    }
}
Was it helpful?

Solution

If you don't load a helper/controller/library but you use some of the functions in it, you will get a white screen too.

That is the first thing I check when I get white screens.

OTHER TIPS

  1. If you’re using mysqli—make sure it’s installed on the machine. CI does not spit out an error, you get just a blank page no source, no nothing.

  2. In your index.php file, if error reporting is set to E_ALL, make sure your logs folder is writeable.

  3. This happened a while ago, but running PHP in CGI mode was causing the same blank page error.

Hope that helps others out there

Reference taken from Codeigniter's forum here and here is another one talking about the blank page issue.

Try using error_reporting(-1)

See: php.net/.../function.error-reporting.php

I use the same setup. Your apache/php/mysql errors are located in /Applications/Mamp/logs folder. You have a php error somewhere. I get this a lot. You have to make sure all your paths are correct etc or this will happen.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top