0
votes

I've developed a CakePHP application, based on version 2.3.0. The app was working on a server with PHP 5.3.3-7 version.

Now, the app has been moved to new environment, with PHP 5.4.34-1 version and it throws fatal error:

Error: include(): Cannot redeclare class debugger File: /home/html/directory/lib/Cake/Core/App.php Line: 560

Does anyone have a clue, what could cause this problem? I know what such problem means (that I cannot redeclare a class), but I don't know how to fix it.

1
You have to look into the file which you are including and compare the class definitions with the class definitions from the script where your including the other file! If you find 2 identical class definition's you could delete one! If they are different you have a bigger problem :D (Also post your code where you include the file and Line 560 of the other file!) - Rizier123
But this is the CakePHP core file. I don't think modifying it would do any good. - anna_pw
I think that if it would be a core Cake file problem, others would encounter it too, and I didn't find exact same problem on the web. Apart from that, why would the same app work before, on other server, without such problem? I'm thinking this is maybe rather a problem with some server configuration or maybe the new PHP version (like, it has built-in class named debugger?) But I don't know which trail to go. - anna_pw

1 Answers

0
votes

I know this is an old question, but since this coincided with moving to PHP v. 5.4, a likely fix is changing your Error level in the core.php file from

'level' => E_ALL & ~E_DEPRECATED,

to this

'level' => E_ALL & ~E_DEPRECATED & ~E_STRICT,

PHP 5.4 includes E_STRICT in the E_ALL set, unlike previous versions.