Jump to content

Cannot redeclare class Magento


Coplestone

Recommended Posts

Hello Guys,

I have an interesting issue in Magento. After a site backup and transfer onto a new domain the front-end of my website loads fine, however when I try to navigate to:

domain.com/index.php/admin

I get a white page. I have enabled debugging mode and it displays this error:
 

1 Array ( [type] => 64 [message] => Cannot redeclare class Mage_Admin_Model_Session [file] => /var/www/vhosts/domain.co.uk/sub-domain.co.uk/includes/src/__adminhtml.php [line] => 504 )


Since finding this new error, I've tried to comment/remove every class that it cannot redeclare in the __adminhtml.php file, one by one.. Only to find that by the time I've commented them all out and refreshed the admin page, it gives no error whatsoever. Just a white page.

Any ideas?

Any help is much appreciated. 

Link to comment
Share on other sites

the problem's not in the actual code. it's in the environment where the code is running. the code suddenly didn't alter itself and start including/requiring the same class definition multiple times just because you moved where it is running.

 

the code is probably trying to load same-name classes, but from different locations, and it or php cannot build or resolve the different locations correctly.

 

some suggestions -

 

1) make sure that the php include_path setting is the same between the old and new system and that is whatever is suggested by magento.

 

2) the code may be trying to use set_include_path()/ini_set() statements to control where it's telling php to search for files, but those functions are either disabled on the new server or the path separator character being used is hard-coded and doesn't match the usage for the operating system (this would only be the case if you switched to/from a Windows/non-windows operating system.)

 

3) php has had a few bugs involving file paths for included/required files. check the php bug reports for the php version being used and the php change log for versions higher than your version, to see if this may be the case.

 

4) i saw references to caching/'compiled' code when doing a search for this general error. make sure that any sort of php bytecode caching/accelerator/APC files that came from the old system have been deleted. perhaps there's a bug in the cache 'hit' logic and the actual php file and the cached/'complied' php code are both being included/required.

Edited by mac_gyver
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.