CodeIgniter white screen on load (undefined base_url in Loader)-Collection of common programming errors

I cannot for the life of me figure out why my CodeIgniter install is not loading. I’m sure all my config files are correct, I even have error_reporting(E_ALL) and ini_set('display_errors', 1); set.

No matter what, I get a blank page.

In my error logs I found this:

[Wed Apr 27 11:08:15 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function base_url() in /var/www/html/system/libraries/Loader.php on line 255

Has anyone seen this error?

Line 255 is:

$CI->dbutil =& new $class();

Where $class is

$class = 'CI_DB_'.$CI->db->dbdriver.'_utility';

and $CI->db->dbdriver is 'mysqli'.

I used grep, and couldn’t find a call to base_url anywhere in the Loader class or Database class.

EDIT: After changing some files (including the .htaccess file) and then changing them back, I got a different error:

The URI you submitted has disallowed characters.

EDIT 2: Going to http://myurl.com gives a blank page, but http://myurl.com/controller gives the “disallowed “characters error.

EDIT 3: Apache was running as the wrong user, and my DB settings were wrong. After fixing those, the site works, but only if $config['permitted_uri_chars'] is blank. Otherwise I get the “disallowed “characters error.

UPDATE: Solved the issue! This new server has PHP 5.3, and the other servers have 5.2. preg_quote is different in 5.3, so I had to fix it by following the instructions here: http://davidmichaelthompson.com/2009/09/03/fixed-the-uri-you-submitted-has-disallowed-characters-error-codeigniter/

  1. Is it a permissions issue over any of the CI library files?

    chown www-data system -R maybe? Or 777 it just for testing?

  2. sounds like a syntax error.. check if all files are uploaded completely

  3. Check your base_url in your config.php (in application/config/). Sounds like the syntax might be messed up or there isn’t one defined.

    $config['base_url'] = 'http://your_url/';
    

    Also: Which version of CI are you on? I just loaded up my loader.php file in my working project and my line 255 is a bit different than yours. $CI->dbutil =& instantiate_class(new $class());.. I’m not sure if that is relevant as I don’t poke around much in the system folder but it is worth looking at

  4. You can replace in your autoload.php file with following.

    $autoload['helper'] = array('url');
    

Originally posted 2013-11-09 20:04:16.