I'm attempting to install the Gallery2 beta on the system summarized below. Each time I try to execute "Step 2" in the installation, I get the following message
"Fatal error: Cannot redeclare class galleryutilities in /Library/WebServer/Documents/gallery2/modules/core/classes/GalleryUtilities.class on line 50"
And that's as far as I get. It's entirely repeatable. Any suggestions on what to change or look for?
Thanks// Chris Freeborn
----
Webserver: Apache 2.0.52
Datatabase: MySQL 4.0.23
PHP: 5.0.3
Operating system: Mac OS X 10.3.8
Posts: 8601
hm, haven't seen this before.
please edit install/steps/SystemChecksStep.class and find "function CheckManifest"
just after the "$base = " line add this:
print "$base<br/>";
print dirname(dirname(dirname(__FILE__))) . "/<br/>";
and retry.. what values do you see?
Then remove the two lines you added and also remove the "require_once" line just below them and retry.. this may work.
Posts: 10
I made the changes you suggested and this was the result printed:
/Library/WebServer/Documents/gallery2/
/Library/WebServer/Documents/gallery2/
Fatal error: Cannot redeclare class galleryutilities in /Library/WebServer/Documents/gallery2/modules/core/classes/GalleryUtilities.class on line 50
When I removed the two print statements the same error fatal error repeats. Any other suggestions to debug?
//Chris Freeborn
Posts: 7994
That is odd. But ok, we can figure this out. From mindless test it looks your __FILE__ directive works. Try removing his lines and then editing modules/core/classes/GalleryUtilities.class and adding this to the top of the file right below the <?php line:
That's a little macro I use to dump out the current location. We should see two stack traces, get printed out. Capture those and post 'em here and we'll have a chance of figuring out what's going wrong.
Posts: 10
I added the line and the following appears at the top of the first page of the installation:
And then when I get to the step after "Authentication" I see the following:
Hopefully this helps!
//Chris Freeborn
Posts: 7994
Ok, that is interesting. We are including the same file from two different places, but we use something called "require_once" which is supposed to guarantee that it doesn't load the same file twice. Apparently that is failing, which might be a bug in PHP. Let's see if we can figure out why.
in install/steps/SystemChecksStep.class on line 237 change:
to:
Then on line 44 of index.php, change:
to:
You can comment out or delete the lines you added before. This will generate some additional output when you try the installer. Post that here and we'll see if we can figure out what's going on.
My guess thus far is that this is a bug in PHP5, which has some known issues especially on less commonly used server platforms (like the Mac). If you don't want to go through the pain of dealing with unstable software, you might downgrade to PHP 4.3.10. But then again, you're installing G2 Beta so my guess is that you're willing to try bleeding edge stuff
Posts: 8601
bharat, we can also remove that require_once since GalleryUtilities now gets included in index.php
Posts: 7994
Duh! Good idea. I've removed that. So this should make this problem go away for cbfreeborn, but I bet he'll have other similar ones.
Posts: 10
I made the changes suggested and here's the result at Step 2:
index.php /Library/Webserver/Documents/gallery2/modules/core/classes/GalleryUtilities.class
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /Library/Webserver/Documents/gallery2/install/index.php:45) in /Library/Webserver/Documents/gallery2/install/index.php on line 76
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /Library/Webserver/Documents/gallery2/install/index.php:45) in /Library/Webserver/Documents/gallery2/install/index.php on line 76
[SystemChecksStep] /Library/WebServer/Documents/gallery2/modules/core/classes/GalleryUtilities.class
Fatal error: Cannot redeclare class galleryutilities in /Library/WebServer/Documents/gallery2/modules/core/classes/GalleryUtilities.class on line 51
Appreciate your patience and help!
//Chris Freeborn
Posts: 8601
this is what i posted in my first reply.. not clear you ever tried it:
also remove any debug output you added in index.php
Posts: 10
I forgot to delete the lines as you suggested. When I did delete them, I was able to successfully get through Step 2 and all the way to Step 7. At this point I get the following fatal error message:
Fatal error: Cannot redeclare class galleryutilities in /Library/WebServer/Documents/gallery2/modules/core/classes/GalleryUtilities.class on line 51
Progress!!
Thanks// Chris Freeborn
Posts: 7994
I think this has something to do with filename case insensitivity on the Mac. I think that even if you get through the installer there are going to be more issues that we'll need to resolve. I've been unable to reproduce this problem on my Mac, though. Would it be possible for me to ssh to your box and check it out directly? Thanks.
Posts: 10
Well, at the moment I'm in development mode and all of my systems -- including the Mac OS X are behind a router/NAT and not directly exposed. Perhaps you could send me a pm and give me some insight as to options for enabling ssh access.
Appreciate your ongoing help.
//Chris Freeborn
Posts: 8194
bharat: joan has experienced this problem too. You may want to talk to her, as she can probably either (1) help resolve it or (2) give you access to poke around.
Posts: 3473
Yup, I had this problem. It's a strange bug in php/os x. If you want to see it in action, create files called j.php
and jj.php
Then view j.php in your browser. What I saw was this:
/Users/jem/Sites/g2/j.php
/Users/jem/Sites/G2/jj.php
The fix for me was to rename the gallery directory from g2 to G2 and use that in the browser. So try renaming your directory to GALLERY to see if that fixes it.
joan
- first posting in 10 months!!
Posts: 10
I changed the name of the gallery2 directory to GALLERY2 and the g2data directory to G2DATA and reran the installation. It failed again at Step 7 with the same fatal error:
Fatal error: Cannot redeclare class galleryutilities in /Library/WebServer/Documents/GALLERY2/modules/core/classes/GalleryUtilities.class on line 51
Is the suspected upper/lower case (in)sensitivity causing a problem at an even lower level?
//Chris Freeborn
Posts: 3473
This is weird. I tried to pin it down to a small test file, but I couldn't reproduce the problem. Then I thought I'd reproduce it by doing the install again. Despite my doing "everything the same as the first time", the installation went through fine.
I've tried a couple more times, and I can't reproduce it.
But anyway, are you typing GALLERY2 in the browser?
joan - 2nd posting in 10 months!
Posts: 10
I went back and made sure I used upper-case in the browser access (both Safari and Firefox) and ran into the same fatal error at Step 7.
BTW, after this fatal error occurs at Step 7, I get the following error message if I try to access Gallery2 again from the browser:
------------
Error (ERROR_STORAGE_FAILURE) :
* in modules/core/classes/GalleryStorage/DatabaseStorage.class at line 1136 (MySqlDatabaseStorage::error)
* in modules/core/classes/GalleryStorage.class at line 220 (MySqlDatabaseStorage::search)
* in modules/core/classes/Gallery.class at line 189 (GalleryStorage::search)
* in modules/core/classes/helpers/GalleryPluginHelper_simple.class at line 256 (Gallery::search)
* in modules/core/classes/helpers/GalleryPluginHelper_simple.class at line 197 (Gallery::fetchAllParameters)
* in modules/core/classes/GalleryCoreApi.class at line 203 (Gallery::getParameter)
* in modules/core/classes/Gallery.class at line 507 (Gallery::getPluginParameter)
* in modules/core/classes/Gallery.class at line 479 (Gallery::getActiveLanguageCode)
* in init.php at line 140 (Gallery::initTranslator)
* in main.php at line 32
-------------------------
I have to go in and delete config.php in order to be able to restart the installation. This scenario might be something that should be accounted for more gracefully in the production version.
Thanks// Chris
Posts: 7994
There's no way that we're going to be able to gracefully handle this; as far as I can tell something is seriously wrong with PHP and if PHP is lying to us we can't really cope.
I can't reproduce this on my Mac so I can't really debug it. It sounds like Joan can no longer reproduce it either. I need to reproduce it to fix it, I think. Chris, do you have a local sysadmin you can talk to who can help you configure your NAT properly so that we can get external access? Or can somebody here walk him through the process? thanks.
Posts: 10
I'm the sysadmin (as well as chief cook and bottle washer etc etc) so you can walk me personally through what needs to be done.
Thanks for your patience// Chris
Posts: 1
I can reproduce both of the problems mentioned on this thread on my mac:
Webserver: Apache 1.3.33
Datatabase: MySQL 4.0.22
PHP: 4.3.10
Operating system: Mac OS X 10.3.8
I run into the __FILE__ directive complaint, as well as the error at step 7 mentioned above. I've done a little hacking about and it appears that the problem with the file directive involves the following:
inside of SystemCheckStep.class, the magic constant __FILE__ returns a relative path (which looks sth like "./steps/SystemCheckStep.class"), which most certainly makes SystemCheckStep::CheckFileDirective() barf.
Curious thing is though, that at a higher level, such as /install/index.php, __FILE__ returns a fully qualified path. I'm stumped. This code works just fine on my OpenBSD box.
So, when I just brute force it to pass step 2, i get all the way to step 7, and I hit this problem, but for me it says:
--------------------
Fatal error: Cannot redeclare class galleryutilities in ./steps/../../modules/core/classes/GalleryUtilities.class on line 50
--------------------.
Any Ideas?
Posts: 7994
Gurami, any chance that I can ssh to your box and inspect this directly? I can't reproduce it on my Mac and it's really hard to figure out how to resolve it if I can't seet it first hand and try tinkering with the code.
My guess from what I've heard is that there's not much that G2 is going to be able to do about this. We depend heavily on the __FILE__ directive and it's gotta work properly. If it's busted then we're dead in the water (which is why we check for it as soon as we can and tell you).
However, I will be happy to log onto your box and try to isolate it into a small script that we can use to file a bug on bugs.php.net and get them to fix it! But I need access...
Posts: 10
Bharat -
Has there been any further troubleshooting or testing re this problem? I'm willing to offer you access to my system if we can work out the logistics.
Thanks// Chris Freeborn
Posts: 7994
Sadly, I'm baffled. Gurami gave me access to his box where he was having the problem, and when I tried to install -- I had no problems! So I still can't reproduce this
Posts: 1
I am experiencing the same issue that is being discussed here. If you would like, I can offer another test envionment...
Posts: 7994
littlejo, I'd love to test it out in your environment. Please send me your ssh details via private message and I'll try it out. Thanks.
Posts: 4
I have the same problem with Gallery 2.0 as I click on "Continue to step 3" -
Fatal error: Cannot redeclare class galleryutilities in /Volumes/binky/WebServer/Documents/tools/gallery2/modules/core/classes/GalleryUtilities.class on line 50
OS X Server 10.3.9
Apache 1.3.33
php 4.3.11
MySQL 4.0.24
Posts: 32509
chadmriden, please PM (write to author) bharat. he may not have that much time (right now), but if you can give him SSH access such that he can debug your issue, maybe he can find the time, since it seems to be an important issue.
Posts: 2
Has a solution been found for this thread yet? I tried to install G2 today and got the same error message during step 3.
Posts: 32509
there are a couple of issues in this thread. do you mean "cannot redeclare" or the __FILE__ issue?
__FILE__ -> your php is bugged, g2 won't work with it.
cannot redeclare -> your php doesn't work correctly, it's very weird.
Posts: 2
Sorry... mine is the 'cannot redeclare' weird issue. If needed, I can set up a user on my OSX Box for ssh access.
Posts: 32509
please read my last answer for chadmriden, the same applies to you.
Posts: 4
I can't get a test account with ssh access to that box, but I'm working on setting up a mirror that we can put test accounts on..
Posts: 6
I've the same problem. I'm running Mac OS X 10.4.3 with Apache/1.3.33 (Darwin) PHP/4.3.11
Though, when I run g2 form my home directory ~/Sites/ it works fine. When running from /Library/WebServer/Documents/ I get the __FILE__ directive problem.
Posts: 32509
from #gallery (irc)
Posts: 4
any updates on to get this to work?
Posts: 4
I upgraded php to 5.1.x & it worked just fine. That broke some of the functionality of the default os x server version of SquirrelMail, but if you upgrade that to the latest-greatest, it works ok too.
Posts: 4
we got php 5.1.4 installed but still get:
Fatal error: Cannot redeclare class galleryutilities in /Library/WebServer/Documents/gallery/modules/core/classes/GalleryUtilities.class on line 50
I have not tried all the code mods from above. Is that what you did chadmriden?
thanks
Posts: 4
I didn't modify Gallery at all.
Now that I think of it, I may have upgraded to server 10.4.x before re-attempting the Gallery2 install.. so if you're on 10.3.x there might be more fundamental issues.