How are you? Hope you are fine. Now, I am going to show how to recover a Fatal Error in codeigniter.
In codeigniter, sometime you will face some fatal error like the below-
Fatal error: Call to undefined function base_url()
If you face that kind of fatal error, then you have to understand this is for base_ulr() function only, nothing else.
You know, base_url() is function is based on url at codeigniter. That’s why, you have to mentioned the url in your controller or autoload.php file. I suggest to put url in your autoload file. Thats why you have to go to your codeigniter directory and open /system/application/config/autoload.php file. Now, find out the $autoload[‘helper’] = array(); line. It can be 54 no line. (Currently I am using the CI version 1.7.3).
Then you have to put down the url into array(). You code will like the below-
$autoload[‘helper’] = array(‘url’);
Now, save your file and run your controller file by the browser.
Hope, it’s solve out now. Thanks for reading. Bye.