I am used codegniter 1.7.1 older version for my real estate stie and it is working fine in local host xamp server.

But when i uploaded in to server, the site not working , showing error as "Fatal error: Cannot redeclare class Locale in /application/libraries/Locale.php on line 12"

pls help me how to solve this ..

thanks in advance..

Recommended Answers

All 9 Replies

You are trying to redeclare the locale class in a file of yours.

It is working fine in localhost, the problem exisiting in only server.

Please post the code where you are declaring your languages.

I think its here, in local_helper.php

        function __($text, $domain = 'default') {

        $CI =& get_instance();


        return $CI->locale1->tr($text, $domain);


        function _e($text, $domain = 'default') {

        echo __($text, $domain);


And here is Locale.php

        class Locale1 {
        var $_data;
        var $locale;
        var $_l10n;
        var $table;
        var $codes;
        var $default;

        function Locale() {
            $this->table = ('languages');
            $this->obj =& get_instance();
            $this->codes = $this->get_codes();
            $this->default = $this->get_default();

            if (!$this->obj->session->userdata('lang')) {
                $this->obj->session->set_userdata('lang', $this->default);

            log_message('debug', 'Locale Class Initialized');



I have fixed the problem now, thanks.

You loaded the locale class, did you eliminate that and it worked ?

I have renamed locale.php and its class name etc.

Ok, good work on debuging your mistakes! :)

remove Internationalization extension if not needed and restart apapche it will work !

sudo apt-get remove php5-intl --purge
sudo service apache2 restart

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.