Critical error: There was an error while processing a database query Critical error: There was an error while processing a database query
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Critical error: There was an error while processing a database query

Started by HVW, February 29, 2024, 07:37:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HVW

I just finished a fresh new install of Coppermine 1.6.26. After a succesfully install I get an error on my Coppermine page.
All settings are still default, nothing changed yet.
I checked update.php, no errors.

These are my site settings:
http://beeldbank.hvwormerveer.nl/
CPG version: 1.6.26
PHP version: 8.2.15

Is there anyone who can help me with this problem?

HVW

Fixed it by myself!

My conclusion is that the cause of this problem is in the 'sql_mode'. That setting is managed by the hosting partner, so I had to make a workaround.
In the logging of Coppermine I found errors:

QuoteGROUP BY r.aid
ORDER BY NULL' in index.php on line 362 the following error was encountered:
1055 : 'databasename.c.cid' isn't in GROUP BY

I edited index.php from this:
Quote// album stats for regular albums
    $sql = "SELECT r.aid, c.cid, COUNT(pid) AS pic_count, MAX(pid) AS last_pid, MAX(ctime) AS last_upload, depth AS level, lft
        FROM {$CONFIG['TABLE_CATEGORIES']} AS c
        INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.category = c.cid
        INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = r.aid
        WHERE c.depth >= $CURRENT_CAT_DEPTH + 1
        AND approved = 'YES'
        $forbidden_set
        $lft_rgt
        GROUP BY r.aid
        ORDER BY NULL";
To this:
Quote// album stats for regular albums
    $sql = "SELECT r.aid, c.cid, COUNT(pid) AS pic_count, MAX(pid) AS last_pid, MAX(ctime) AS last_upload, depth AS level, lft
        FROM {$CONFIG['TABLE_CATEGORIES']} AS c
        INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.category = c.cid
        INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = r.aid
        WHERE c.depth >= $CURRENT_CAT_DEPTH + 1
        AND approved = 'YES'
        $forbidden_set
        $lft_rgt
        GROUP BY r.aid, c.cid, c.depth, c.lft
        ORDER BY NULL";

Then the error dissapeared and Coppermine worked like a charm!