Rizwan Khan
Rizwan Khan

Reputation: 401

My website is throwing "PHP Fatal error: Call to undefined method CI_Lang::lang()"

I created a website using CodeIgniter Framework 2.1.0 that was originally working well. Yesterday, I integrated this i18n code into the site for multi-language support. Now, when I upload my site to cpanel and open it, I get this error in my log file:

[21-Nov-2011 10:19:04] PHP Fatal error: Call to undefined method CI_Lang::lang() in XXXX

However, the website is working well on my localhost server (xampp for Windows). What's wrong?

Upvotes: 0

Views: 3034

Answers (3)

stormdrain
stormdrain

Reputation: 7895

See the thread attached to the library: http://web.archive.org/web/20120112092127/http://codeigniter.com/forums/viewthread/179036. In the first post is attached a modified library that claims to alleviate the buggyness of the original.

There is also a post on the first page there referencing an error similar to yours:

After copying the files as described in the article I get the following error: Fatal error: Call to undefined method CI_Lang::CI_Lang() in /www/websites/audio-machinery/application/core/MY_Lang.php on line 32

Though he seems to be calling CI_Lang, not Lang. His solution appears to have been to use the code attached to the forum thread.

Also, cpanel is a control panel for hosting, not a hosting provider. But your hosting provider may be causing issues (e.g. if using older versions of PHP which do not work with newer version of CI. Often hosting providers will give you the ability to choose which version of PHP you are using--usually found in cPanel).

Upvotes: 1

Innam Hunzai
Innam Hunzai

Reputation: 462

I came accross the same problem.... it was working fine on localhost but when loaded on live server it gives me undefined error... the problem appears becuase I created file with name My_Lang.php and My_Config.php as on live server it is case sensitive.... so I changed it to MY_Config.php and MY_Lang.php .... it works fine now.... Hope it will work for you too

Upvotes: 0

Nick
Nick

Reputation: 906

have you uploaded ALL the new files to your live server? that error implies that the code is not found or available to the script.

Upvotes: 1

Related Questions