"Gallery has not been configured!" suuuure it hasn

MattSF

Joined: 2002-11-13
Posts: 3
Posted: Wed, 2002-11-13 09:08

Hi, new to Gallery and have been beating my head on the table over this for a while. It's time to give up now and go to sleep. But before then, I hope someone can shed some light.

I run the setup for configure, configure with the browser, save it (it actually saves the config.php file), go secure, and hit the gallery main URL and... "Gallery has not been configured!" The URL it takes me to is .../gallery/albums.php

I am running the following: NetBSD 1.6, Apache 1.3.27 (with modules rewrite, and php), PHP 4.2.3, Gallery 1.3.1. The Gallery setup pages gives me 'green' on all the binaries. PHP session testing looks good. I have also tried Gallery 1.3.2-cvs-b26 and get the same result. I tried setting register_globals to On (per FAQ C.14) but nothing changes.

There is no useful info in the httpd error log. Just the same "Undefined variable: GALLERY_BASEDIR" that many people report :smile: Is this unrelated...or not? I see several posts differing on this. But my php include path is default, and I'm not running Apache 2, etc etc :smile:

hope someone can help. thanks!

 
xman

Joined: 2002-11-06
Posts: 9
Posted: Wed, 2002-11-13 11:39

Humm it's looks exactly like my problem :

see http://gallery.menalto.com/modules.php?op=modload&name=phpBB_14&file=index&action=viewtopic&topic=1537&12

Perhaps a compatibility problem with PHP 4.2.3 ....

I try to add a line " $GALLERY_BASEDIR="/home/wwwroot/gallery"; " in index.php just before the line " include("albums.php"); ". The message : "Gallery has not been configured!" disapeer but gallery doesn't work.
I think to a problem when reading the config, not writing but i'am not sure.

I promise, if i find, i'll tell you :smile:

 
MattSF

Joined: 2002-11-13
Posts: 3
Posted: Wed, 2002-11-13 14:38

hmm interesting but note I am not even trying for the "brass ring" of Apache 2 :smile:

I tried searching in the discussion forums for PHP 4.2.3 or even 4.2.2 but something weird about their search engine won't "see" the last digit of that string. So if there are posts out there about PHP 4.2.3 finding them might be a bit difficult :smile:

I'll try downgrading my PHP version, the problem is I installed from NetBSD package source but I should be able to hack the Makefile/download target. I love free software as much as the next guy, but this is getting ridiculous :razz:

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2002-11-14 06:00

Don't downgrade PHP -- that is not the issue.

When Gallery is in secure mode, it checks to see if the "config.php" file exists. If it doesn't, it complains that Gallery is not configured. This check happens in util.php:gallerySanityCheck().

So, let's do a couple of things. Put the following lines into gallerySanityCheck right below the "globals" lines:

print "DEBUG START<br>";
print "Gallery basedir: $GALLERY_BASEDIR<br>";
system("pwd"); print "<Br>";
print "fs_file_exists: " . fs_file_exists($GALLERY_BASEDIR . "config.php") . "<br>";
print "broken_link: " . broken_link($GALLERY_BASEDIR . "config.php") . "<br>";
print "gallery->app" . $gallery->app . "<br>";
print "DEBUG END<br>";

then next time you load Gallery it'll give some extra debug out. Post that here and that may help us figure out what's going wrong.

 
xman

Joined: 2002-11-06
Posts: 9
Posted: Thu, 2002-11-14 09:45

Here is the debug information i get :

DEBUG START
Gallery basedir:
/home/wwwroot/gallery
fs_file_exists:
broken_link: 0
gallery->appObject
DEBUG END

I think i've located the problem. the test fs_file_exists fail even if the file really exist.
My _ENV["PATH"] is set to : /bin:/usr/bin:/sbin:/usr/sbin
and i think that the file_exists function use this path. So when testing file_exists("file.ext") PHP search the file in /bin:/usr/bin:/sbin:/usr/sbin but NOT in current dir !

My problem is that i don't know how to change the _ENV["PATH"]
because i don't know wich shell php is running under.

If you can help me ...

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Thu, 2002-11-14 10:11

Well, in this case, it should be looking in the directory located in the "PWD" environment variable, which is the correct /home/wwwroot/gallery directory. Hmm. Very strange indeed.

There is an existing and well-known problem with Apache 2 and PHP 4.2.3 where file_exists() (among other functions) will not work except with absolute paths (i.e. the environment variables aren't properly inherited to PHP). So file_exists($file) would fail but file_exists(getcwd() . "/" . $file) should work. However, this is not supposed to be a problem with 4.2.3 and Apache 1.3.x. I would be interested to see if this would fix your problem. Are you 100% sure you're not running Apache 2?? (I believe that a CVS snap of PHP 4.3 will have this fixed, though I'm not certain).

-Beckett (beck@beckettmw.com)

 
xman

Joined: 2002-11-06
Posts: 9
Posted: Thu, 2002-11-14 14:34

I USE apache 2

 
MattSF

Joined: 2002-11-13
Posts: 3
Posted: Thu, 2002-11-14 18:06

hey all thanks for responding. well, don't hate me but I hacked init.php with a hard-set GALLERY_BASEDIR so that I could get up and running. hey, it's baby pics for a friend, you know how those newly-become-parents are.... :smile:

But I wanna do it right, so I'll try adding the debug code today when I have a chance. And then I'll report back!
-matt

 
xman

Joined: 2002-11-06
Posts: 9
Posted: Thu, 2002-11-14 21:11

:smile: :smile: :smile: :smile: I FIXED IT !! :smile: :smile: :smile: :smile:

My problem was really that file_exists don't work properly with relative path.
I first try to modify the line return @file_exists($filename); by return @file_exists(getcwd()."/".$filename); in function fs_file_exists() in platform/fs_unix.php but there was a problem when checking for netpbm binaries because it use absolute path here.

Finally, I replace the line by this one : return @file_exists(realpath($filename)); wich fix the problem and wich is not so bad as hardcoding the $GALLERY_BASEDIR that I tried too.

I'm really happy to get an issue to this problem because I find this software really good and I actually don't know something better to publish photos on the internet.

Thanks to all people trying to help the others with forums.
...and sorry for my poor english (i'm from france).

Have a nice day.

X-Man
<!-- BBCode Start --><A HREF="http://xman.homelinux.org/perso/gallery" TARGET="_blank">http://xman.homelinux.org/perso/gallery</A><!-- BBCode End -->