WordPress "Fatal error: Cannot redeclare"

Status
Not open for further replies.

lostcommander

Member
Messages
52
Reaction score
0
Points
6
A couple times in the past few weeks I saw my site up and THOUGHT the whole moves and updates etc. stuff was finished and so continued working on the site, so I am not sure how much that might have caused this.

#1) I first ran into:
Code:
Fatal error: Cannot redeclare wp_unregister_globals() (previously declared in /folders/wp-united/wpu-actions.php(45) : eval()'d code:53) in /folders/wp-united/wpu-actions.php(45) : eval()'d code on line 3704
When I was trying to log out from my site. I tried things like clearing the cache to no avail.

#2) I noticed that I had WPU 0.8.4.1-RC2 instead of 0.8.5, so I tried to update WPU. This lead to WPU becoming completely inoperative and, in the PHPBB3 ACP:
Code:
Fatal error: Cannot redeclare wp_unregister_globals() (previously declared in /folders/phpbb/includes/acp/acp_wp_united.php(2043) : eval()'d code:53) in /folders/phpbb/includes/acp/acp_wp_united.php(2043) : eval()'d code on line 3704
To fix this I tried uninstalling WPU with the intent of reinstalling it, but I ran into the exact same error on the last step of the settings wizard.

#3) I read a post online that perhaps this kind of problem could be caused by file corruption. This sounded possible since I had at this point read about the data center move (but did not realize yet that it was not complete), so I figured I would re-upload all of the WordPress [plain/vanilla] files since the initial problem was stemming (well, so I thought) from the wp-settings.php file since that was the only place that function was defined and thus the only place it could be redeclared. So, I downloaded WordPress, uploaded the .zip, unpacked it, and THEN noticed I had just uploaded 2.9.2 and not the 2.?.? that I had before (I am pretty sure it was 2.8.?, but it might have been 2.9.1). My blog then (and still) shows:
Code:
Fatal error: Call to undefined function wp() in /folders/blog/wp-blog-header.php on line 14

#4) I figured this meant that, since I had not done whatever the "correct" WP update procedure is, I had just unintentionally broken WordPress. There were no important blog posts, so I figured it was fine to just try to reinstall WP then reinstall WPU. So, I dropped the WP tables from the database, deleted the entire folder containing WP, uploaded the .zip, extracted it, went to /install.php, and got:
Code:
Fatal error: Call to undefined function is_admin() in /folders/blog/wp-admin/includes/comment.php on line 162

NOW) That is when I noticed the update from Corey stating that only a couple of the servers (not including mine) had finished the move and so I put this all on hold in the hopes that the move being finished would stop the errors from occurring. It sounds like the crazy train is finally over for now and I am still getting that last error which prevents me from reinstalling WordPress 2.9.2. My only idea at this point is to try one of the cPanel one-click-install scripts and HOPE that makes a working install, then try to modify it back to my original settings (e.g. shared database).

Does anyone have any other ideas on possible courses of action, either for me or for anyone else who might run into this problem sometime?

Does anyone have any idea why this might have occurred in the first place? Do note that the original problem at the very beginning of my messing with stuff occurred after nothing I did that I know of (although admittedly I do not log off a lot while developing since I need to keep checking things like permission settings).

Thank you very much for any insight anyone might have. I will update this thread with my progress if I manage to arrange some kind of solution on my own.
 

lostcommander

Member
Messages
52
Reaction score
0
Points
6
Update:
1) I used Fantastico to auto-install WordPress.
--) I navigated to the installation and it had been successful; there was a brand new WordPress blog there.
2) I exported the WordPress structure.sql from the new database.
3) I imported the WordPress SQL structure to the original database.
4) I imported my old backed-up WordPress database data to the original database.
5) I uploaded my original WordPress wp-config.php file.
--) I navigated to the WordPress blog and it gave me the redeclaration error.
6) I downloaded the new WordPress wp-config.php file, edited it so it looked like my original configuration, and re-uploaded the new wp-config.php file.
--) I navigated to the WordPress blog and it showed me my old blog (sans WP-United).
--) I re-download the wp-config.php file I just uploaded and see that upload+download has stripped it of all its previously double-spaced-ness.
X-- My conclusion is that file formatting is somehow at least partially responsible for this mess.

7) I went to the PHPBB3 admin WPU tab and redid the the setup wizard and it has once again given me a fatal error (this time the line number is SLIGHTLY different; maybe due to slightly different wp-config.php file?):
Code:
Fatal error: Cannot redeclare wp_unregister_globals() (previously declared in /folders/forum/includes/acp/acp_wp_united.php(2043) : eval()'d code:51) in /folders/forum/includes/acp/acp_wp_united.php(2043) : eval()'d code on line 3698

I am now hunting for a way to mass reformat the files so they are all double-spaced or whatever it is that will fix these strange issues.

FYI I am using NetBeans and Notepad++ for code viewing and editing.
 

Christopher

Retired
Messages
14,659
Reaction score
8
Points
0
Hello,

The problem appears to be with the WP-United. You will have to contact them for support.
 

lostcommander

Member
Messages
52
Reaction score
0
Points
6
@ Christopher: So it is certain that the new servers do not have some odd setting that is messing with file formats in any way? If so, then what's up with upload+download stripping out all the blank lines?

I suspect you are right that it is WPU and I have had a thread there with these questions for a couple weeks now (since March 24th), but have gotten no suggestions other than "clear PHPBB cache", which did not work. If this forum is the wrong location for this thread, then I apologize and would appreciate it if someone maybe moved it to Programming Help perhaps? Or maybe Third Party Apps?
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
@ Christopher: So it is certain that the new servers do not have some odd setting that is messing with file formats in any way? If so, then what's up with upload+download stripping out all the blank lines?

I suspect you are right that it is WPU and I have had a thread there with these questions for a couple weeks now (since March 24th), but have gotten no suggestions other than "clear PHPBB cache", which did not work. If this forum is the wrong location for this thread, then I apologize and would appreciate it if someone maybe moved it to Programming Help perhaps? Or maybe Third Party Apps?

It's wrong section /now/ but it wasn't to begin with; the issue's actually a really simple one to explain but heck if I know how to solve it.

PHP, like a lot of languages, lets you define your own functions for when you're planning to do something reeeeely often.

Fatal error: Cannot redeclare wp_unregister_globals() (previously declared in /folders/forum/includes/acp/acp_wp_united.php(2043) <-- means it's trying to re-declare wp_unregister_globals() - it's already been defined in acp_wp_united.php, but something's trying to declare a function with the same name. IT should be an easy fix but given that it's wp-united I'm not sure -where- to actually start, cause anything I suggest changing could very well break everything else :(
 

lostcommander

Member
Messages
52
Reaction score
0
Points
6
But it is NOT defined in acp_wp_united.php ... I have all of the code stuffed into NetBeans and the ONLY place that function is defined is in wp-settings.php (a vanilla WordPress file). If you follow all of the include_once() and require_once() calls, eventually you get to wp-settings.php. However, only _once() calls are ever made, which should prevent redeclaration (or even re-inclusion of the code), right?? Also, no files have thousands of lines of code, so I have no clue how PHP if complaining about such absurdly high/large line numbers. I am still completely stumped and somewhat frustrated because the site has been unusable for over two consecutive weeks now.

And yeah, whatever is wrong is probably really easy to fix if I only knew what to do... *sigh*

I wonder if there are any other circumstances under which "Fatal error: Cannot redeclare" occurs.
 

galaxyAbstractor

Community Advocate
Community Support
Messages
5,508
Reaction score
35
Points
48
If this is a phpBB mod, did you happen to install it using autoMOD?
 

lostcommander

Member
Messages
52
Reaction score
0
Points
6
WP-United is a phpBB mod, or at least it installs like one and all of its modifications and changes are to phpBB files. autoMOD sounded like another phpBB mod, and I did not see the point in installing 2 mods instead of 1. Also, the WP-United installation instructions warn that autoMOD may break modified phpBB installations and I have already modified the layout by adding a CSS-based navigation system (and maybe something else since it has been almost a year since I started this thing???).

On the other hand I do have very good notes and backups, so thank you @ vigge_sWe for the idea of trying autoMOD to at least see if that does the trick. It seems a rather roundabout way to do it, but so was using Fantastico to generate a not-broken WP install and that worked...
 
Status
Not open for further replies.
Top