cakephpconfigphpredeclare

Cannot redeclare config() error in cakePHP


I am getting the error Fatal error: Cannot redeclare config() (previously declared in.../basics.php:58, in live server. It works fine in my local server but when i uploaded the site to live server, i got the fatal error. I checked if the config() was declared multiple times but it's only declared once in basics.php file. The naming conventions are also followed, as it is working fine in local server. It only displays such error in live site. Please suggest solution for this.

Help on this will be much appreciated.


Solution

  • set $uses to array() and $autoRender to false as follows will solve this problem

       class IndexController extends AppController
        {
    
            public $uses = array();
            public $autoRender = false;
    
            public function index()
            {
                echo 'test';
            }
    
        }