{"id":520,"date":"2022-08-30T15:02:43","date_gmt":"2022-08-30T15:02:43","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/codeigniter-white-screen-on-load-undefined-base_url-in-loader-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:02:43","modified_gmt":"2022-08-30T15:02:43","slug":"codeigniter-white-screen-on-load-undefined-base_url-in-loader-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/codeigniter-white-screen-on-load-undefined-base_url-in-loader-collection-of-common-programming-errors\/","title":{"rendered":"CodeIgniter white screen on load (undefined base_url in Loader)-Collection of common programming errors"},"content":{"rendered":"<p>I cannot for the life of me figure out why my CodeIgniter install is not loading. I&#8217;m sure all my config files are correct, I even have <code>error_reporting(E_ALL)<\/code> and <code>ini_set('display_errors', 1);<\/code> set.<\/p>\n<p>No matter what, I get a blank page.<\/p>\n<p>In my error logs I found this:<\/p>\n<blockquote>\n<p>[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<\/p>\n<\/blockquote>\n<p>Has anyone seen this error?<\/p>\n<p>Line 255 is:<\/p>\n<pre><code>$CI-&gt;dbutil =&amp; new $class();\n<\/code><\/pre>\n<p>Where <code>$class<\/code> is<\/p>\n<pre><code>$class = 'CI_DB_'.$CI-&gt;db-&gt;dbdriver.'_utility';\n<\/code><\/pre>\n<p>and <code>$CI-&gt;db-&gt;dbdriver<\/code> is <code>'mysqli'<\/code>.<\/p>\n<p>I used grep, and couldn&#8217;t find a call to <code>base_url<\/code> anywhere in the Loader class or Database class.<\/p>\n<p><strong>EDIT<\/strong>: After changing some files (including the .htaccess file) and then changing them back, I got a different error:<\/p>\n<blockquote>\n<p>The URI you submitted has disallowed characters.<\/p>\n<\/blockquote>\n<p><strong>EDIT 2<\/strong>: Going to <code>http:\/\/myurl.com<\/code> gives a blank page, but <code>http:\/\/myurl.com\/controller<\/code> gives the &#8220;disallowed &#8220;characters error.<\/p>\n<p><strong>EDIT 3<\/strong>: Apache was running as the wrong user, and my DB settings were wrong. After fixing those, the site works, but only if <code>$config['permitted_uri_chars']<\/code> is blank. Otherwise I get the &#8220;disallowed &#8220;characters error.<\/p>\n<p><strong>UPDATE<\/strong>: Solved the issue! This new server has PHP 5.3, and the other servers have 5.2. <code>preg_quote<\/code> 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\/<\/p>\n<ol>\n<li>\n<p>Is it a permissions issue over any of the CI library files?<\/p>\n<p><code>chown www-data system -R<\/code> maybe? Or 777 it just for testing?<\/p>\n<\/li>\n<li>\n<p>sounds like a syntax error.. check if all files are uploaded completely<\/p>\n<\/li>\n<li>\n<p>Check your <code>base_url<\/code> in your <code>config.php<\/code> (in <code>application\/config\/<\/code>). Sounds like the syntax might be messed up or there isn&#8217;t one defined.<\/p>\n<pre><code>$config['base_url'] = 'http:\/\/your_url\/';\n<\/code><\/pre>\n<p>Also: Which version of CI are you on? I just loaded up my <code>loader.php<\/code> file in my working project and my line 255 is a bit different than yours. <code>$CI-&gt;dbutil =&amp; instantiate_class(new $class());<\/code>.. I&#8217;m not sure if that is relevant as I don&#8217;t poke around much in the system folder but it is worth looking at<\/p>\n<\/li>\n<li>\n<p>You can replace in your autoload.php file with following.<\/p>\n<pre><code>$autoload['helper'] = array('url');\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 20:04:16. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I cannot for the life of me figure out why my CodeIgniter install is not loading. I&#8217;m sure all my config files are correct, I even have error_reporting(E_ALL) and ini_set(&#8216;display_errors&#8217;, 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] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-520","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=520"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/520\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}