configuration loop

rhennig

Joined: 2002-09-24
Posts: 4
Posted: Tue, 2002-09-24 10:58

Hey, I just installed the latest version of gallery on a linux webserver running apache 1.3.x.

I ran the setup.sh script, and now I am experiencing the configuration loop problem, where I keep seeing the "Gallery has not been configured!" error message when I try to run the configuration wizard.

After doing a little debugging, it appears that this is happening because $GALLERY_BASEDIR variable is empty, so this test is failing in gallerySanityCheck:
if (!fs_file_exists($GALLERY_BASEDIR . "config.php") || ...

Where is this variable supposed to be initialized?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2002-09-24 17:57

$GALLERY_BASEDIR is supposed to be empty, unless you're running embedded in PostNuke. So when it's empty, this evaulates to:

if (!fs_file_exists("config.php") || ...

and that should return false, if config.php exists. Does it exist?

 
dougwright

Joined: 2002-09-24
Posts: 1
Posted: Tue, 2002-09-24 19:16
Quote:
$GALLERY_BASEDIR is supposed to be empty, unless you're running embedded in PostNuke. So when it's empty, this evaulates to:

if (!fs_file_exists("config.php") || ...

and that should return false, if config.php exists. Does it exist?

Hm, this is scary. I installed the latest version of Gallery today as well and I think I'm having the same issue.
First, my setup is as follows:

Red Hat Linux 7.3 with kernel upgraded to 2.4.18-10
Apache 2.0.40 (I know, it's not supported)
PHP 4.2.3

I installed it into a current 1.2.2 Gallery as per the directions. When I went to http://gallery/index.php (the URL on my local server) I was prompted to run the setup. I did, then saved my configuration, secured the
Gallery (sh secure.sh) then tried http://gallery/index.php again. Once again I was greeted by the screen
stating my Gallery setup was not yet configured.

At the beginning of the configuraton 'config.php' does exist.

I realize that Apache 2 is not officially supported. I just want to share my experiencs.

-Doug :smile:

 
rhennig

Joined: 2002-09-24
Posts: 4
Posted: Tue, 2002-09-24 22:10
Quote:
$GALLERY_BASEDIR is supposed to be empty, unless you're running embedded in PostNuke. So when it's empty, this evaulates to:

if (!fs_file_exists("config.php") || ...

and that should return false, if config.php exists. Does it exist?

Yes, config.php exists in the gallery base directory. However, when setup/index.php runs the gallerySanityCheck function, the current working directory is setup, so the above line is testing for the existence of setup/config.php, which doesn't exist.

This appears to be a bug, don't you think?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2002-09-25 03:01
Quote:
Yes, config.php exists in the gallery base directory. However, when setup/index.php runs the gallerySanityCheck function, the current working directory is setup, so the above line is testing for the existence of setup/config.php, which doesn't exist.

Uh, setup/index.php does not call gallerySanityCheck. Are you sure you unpacked your tarball correctly? Does your setup/index.php look the same as gallery/index.php?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2002-09-25 03:03
Quote:
Red Hat Linux 7.3 with kernel upgraded to 2.4.18-10
Apache 2.0.40 (I know, it's not supported)
PHP 4.2.3

I installed it into a current 1.2.2 Gallery as per the directions. When I went to http://gallery/index.php (the URL on my local server) I was prompted to run the setup. I did, then saved my configuration, secured the
Gallery (sh secure.sh) then tried http://gallery/index.php again. Once again I was greeted by the screen
stating my Gallery setup was not yet configured.

This could be an Apache2 issue. But you should upgrade to Gallery 1.3.1 (or better yet, 1.3.2 from CVS) first to make sure that this isn't an old bug in the Gallery code.

 
rhennig

Joined: 2002-09-24
Posts: 4
Posted: Wed, 2002-09-25 07:04
Quote:

Uh, setup/index.php does not call gallerySanityCheck. Are you sure you unpacked your tarball correctly? Does your setup/index.php look the same as gallery/index.php?

True, but setup/index.php includes init.php, which calls gallerySanityCheck. Regardless of the details, the function gets called when setup/index.php is executed.

I added the following code to gallerySanityCheck:
$cwd = getcwd();
if (!fs_file_exists($GALLERY_BASEDIR . "config.php")) {
print "<!-- $GALLERY_BASEDIR -->n";
print "<!-- cwd: $cwd -->n";
}
above the line:
if (!fs_file_exists($GALLERY_BASEDIR . "config.php") ||

Upon loading the setup/index.php, I get this:
<!-- -->
<!-- cwd: /home/murals/www/new/gallery/setup -->

This confirms that when $GALLERY_BASEDIR is not set, it is looking for config.php in the setup directory.

What is the best way to fix this? Should I just define the GALLERY_BASEDIR variable? If so, which file should this be defined in? Or is this an indication that something else is wrong?

I'm sure that I unpacked the tar correctly, using a "tar zxf <tarfile>" command with GNU tar. And the gallery/index.php file is twice as big as the setup/index.php file, so I'm not sure what you mean by asking if these files "look the same"

I would greatly appreciate help with this matter, as I am anxious to use this software.

- Ryan

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2002-09-25 07:27
Quote:
True, but setup/index.php includes init.php, which calls gallerySanityCheck. Regardless of the details, the function gets called when setup/index.php is executed.

The details are paramount here. setup/index.php includes setup/init.php which does not call gallerySanityCheck. The config wizard can never call gallerySanityCheck.

Check your PHP include path (in php.ini, or check your phpinfo() ). Make sure it doesn't have ".." as a path element. Don't modify gallerySanityCheck -- that's just fixing the symptoms. Your problem lies deeper.

 
rhennig

Joined: 2002-09-24
Posts: 4
Posted: Wed, 2002-09-25 09:33

Ok, I fixed the problem. :smile:
My include_path had the base gallery dir before the setup dir, so it was grabbing the wrong init.php.

In order to prevent future users from having this problem, it would be helpful to add instructions to the README and user guide on how to setup your include_path properly. Since I didn't have these instructions, I tried to guess and wound up with the wrong setting. :sad:

Thanks for your help.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2002-09-26 03:33

Ah. We don't have any directions in our README about include_path 'cause Gallery doesn't need you to do anything with it :smile: