gen_Eric
gen_Eric

Reputation: 227280

CodeIgniter white screen on load (undefined base_url in Loader)

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/

Upvotes: 1

Views: 5701

Answers (6)

UMAR-MOBITSOLUTIONS
UMAR-MOBITSOLUTIONS

Reputation: 78004

I was having same problem, i installed latest xamp version and found my site is not working, after research and wasting time i found that.

I need to turn on following tag in php.ini file short_open_tag=On

Make sure to restart apache after doing this.

Hope this helps, most of these problems are related to php.ini file or fresh installation if your site was already running as other people facing similar issue.

Upvotes: 1

Caroline
Caroline

Reputation: 1

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

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

Upvotes: 0

gen_Eric
gen_Eric

Reputation: 227280

The solution here was:

  1. Apache was running as the wrong user, and had bad permissions on CI's files
  2. PHP 5.3 has a different preg_quote than 5.2, the fix is here: http://davidmichaelthompson.com/2009/09/03/fixed-the-uri-you-submitted-has-disallowed-characters-error-codeigniter/
  3. Make sure your DB settings are correct

Upvotes: 1

George
George

Reputation: 901

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

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

Upvotes: 1

ItsPronounced
ItsPronounced

Reputation: 5463

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

Upvotes: 0

Flask
Flask

Reputation: 4996

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

Upvotes: 0

Related Questions