$CONIG is NULL in functioins.inc.php $CONIG is NULL in functioins.inc.php
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

$CONIG is NULL in functioins.inc.php

Started by ltiefland, August 12, 2009, 11:48:48 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

ltiefland

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?

Joe Carver

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.

ltiefland

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.

Joachim Müller

Quote from: ltiefland on August 12, 2009, 11:48:48 AM
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!

Quote from: ltiefland on August 12, 2009, 11:48:48 AM
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:
<?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>';
    }
}
?>

Nibbler

I doubt that's the issue.

Check for an .htaccess file in your web root that's intercepting requests for php scripts.

ltiefland

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.

Joachim Müller

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. I recommend to sanitize anyway to be sure.