forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: ltiefland on August 12, 2009, 11:48:48 am

Title: $CONIG is NULL in functioins.inc.php
Post by: ltiefland on August 12, 2009, 11:48:48 am
Hi all,

that's really strange.

On http://www.charlys-bummelzug.de/galerie we have installed coppermine 1.4.10. On the old server erverything was fine and since it has moved to a new server I only get "Unable to connect to database!".
Even with the newest version (http://www.charlys-bummelzug.de/cpg14x/) it does NOT work.

I have traced the problem to the functions.inc.php file. The command "global $CONFIG" somehow does NOT work. The variable is NULL, therefore there is no info for the DB connection.

What's going on?
Title: Re: $CONIG is NULL in functioins.inc.php
Post by: Joe Carver on August 12, 2009, 12:59:01 pm
Your settings for the new server + db need to be entered into file:   include/config.inc.php

This value (imo) just doesn't look to be correct    user 'www-data'@'localhost'

Make sure that your final version is cpg1.4.25 when you are finished.
Title: Re: $CONIG is NULL in functioins.inc.php
Post by: ltiefland on August 12, 2009, 01:03:32 pm
Hi,

that was also my first thought. But when I insert "var_dump($CONFIG);" into the cpg_db_connect() function the output is: NULL

In "init.inc.php" just before the call to the cpg_db_connect() function everything is fine.

Also: An other script using the same connect information works without any problems.
Title: Re: $CONIG is NULL in functioins.inc.php
Post by: Joachim Müller on August 12, 2009, 01:30:06 pm
On http://www.charlys-bummelzug.de/galerie we have installed coppermine 1.4.10.
We will not look into issues that may or may not be related to using outdated versions. The only supported version is the most recent stable release (currently cpg1.4.25). The fact that you installed it another time on the same server makes no difference. Upgrade!

On the old server erverything was fine and since it has moved to a new server I only get "Unable to connect to database!".
We can't help you with your webserver setup. If you're convinced that the data in http://www.charlys-bummelzug.de/galerie/include/config.inc.php is correct, ask your webhost for support. Don't allow them to answer like "third party software goes unsupported" - although Coppermine is third party software from their perspective, you appear to be on the right track: the global command from PHP needs to work no matter what. You could try the attached test script as well:
Code: [Select]
<?php
$CONFIG 
= array();
$CONFIG['foo'] = 'bar';
echo 
test_global_scope();
function 
test_global_scope() {
    global 
$CONFIG;
    if (
$CONFIG['foo'] == 'bar') {
        echo 
'The global command appears to work as expected';
    } else {
        echo 
'The global command doesn\'t seem to work as expected - the content of the array $CONFIG is:';
        echo 
'<pre>';
        
print_r($CONFIG);
        echo 
'</pre>';
    }
}
?>
Title: Re: $CONIG is NULL in functioins.inc.php
Post by: Nibbler on August 12, 2009, 01:49:07 pm
I doubt that's the issue.

Check for an .htaccess file in your web root that's intercepting requests for php scripts.
Title: Re: $CONIG is NULL in functioins.inc.php
Post by: ltiefland on August 12, 2009, 02:08:27 pm
Hi,

Thanks for your help. At first your test script made no output at all. Which was very strange.

After a little searching in the file system I stumbled over a .htaccess file in the root-folder that created the problem in the first place.

After commenting out the lines in that file, everything is fine now.
Title: Re: $CONIG is NULL in functioins.inc.php
Post by: Joachim Müller on August 12, 2009, 04:01:15 pm
Thanks for resolving your thread, and well done on the update.
Could you please (for the benefit of others with similar issues) post the lines from the .htaccess file that you commented out to make your gallery operational again?
I'm a bit concerned that what happened to you was part of a hacking attempt (caused by your reluctance to upgrade in the past), so I'd like to see what caused the issues. In case that this was actually caused by hacking, an upgrade is not enough to be save - you'd have to sanitize your gallery as suggested in the Yikes thread (http://forum.coppermine-gallery.net/index.php/topic,51927.0.html). I recommend to sanitize anyway to be sure.