Advanced search  

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]

Pages: [1] 2   Go Down

Author Topic: There was an error while processing a database query  (Read 14541 times)

0 Members and 1 Guest are viewing this topic.

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
There was an error while processing a database query
« on: February 26, 2006, 06:59:04 pm »

I know this is a thorny subject.. sorry!

recently I've been getting the error...
Notice: Undefined index: debug_mode in copperminegallery/include/functions.inc.php on line 96
Fatal error :
There was an error while processing a database query


As far as I can work out at the moment is that I am overloading my web hosts data base server

My host server allows for 50.000 queries per hour, if this is exceeded it slings you out by the ear  ;D

fair enough I suppose...... my problem is that I am running quite a large gallery, now up to 17.000 images and rising... My guess (again) is that... hitting the search, most viewed or last viewed buttons on the index page can result in a large query count? doing this a few times and the server is tripped?

My questions, do yo think I am right?

Taking out the search, most viewed or last viewed buttons seems to be a quick fix, (I'm not bothered about losing the search button)
but is there a way of only allowing the last/most viewed function on individual albums? (which each only contain a couple of hundred images), rather than on the whole gallery?

Be gentle with me, I have a small Brain  :-\
« Last Edit: March 01, 2006, 08:12:58 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: There was an error while processing a database query
« Reply #1 on: February 26, 2006, 07:05:11 pm »

enable debug_mode, disable notices, paste the actual error message (not the debug_ouput) into your reply here. Post a link to your site as well.
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #2 on: February 26, 2006, 07:19:41 pm »

enable debug_mode, disable notices, paste the actual error message (not the debug_ouput) into your reply here. Post a link to your site as well.
Thank you for your quick reply,
My hosts server still hasn't reset so my gallery is unatainable at present,
I will debug when I get access back, this took 8 hours last time... real pain in the ****

http://www.banburymike.net/copperminegallery

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: There was an error while processing a database query
« Reply #3 on: February 26, 2006, 09:43:37 pm »

you appear to be running cpg1.3.3, I highly recommend upgrading!
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #4 on: February 26, 2006, 10:24:10 pm »

you appear to be running cpg1.3.3, I highly recommend upgrading!
Yes, I've got myself in a bit of bother, my main gallery is cpg1.3.3. which holds about 17000 images in 200+ albums, I've been reluctant to make changes to it,  thinking that I may mess it up and have to start again from scratch.

I am also running seperatly a cpg1.4.3  gallery which I like, I don't know if I can convert my cpg1.3.3. to cpg1.4.4 without losing all of my cpg1.3.3 album info

also I have the paypal hack on both galleries, on the cpg1.3.3 I use the batch pricing, but on cpg1.4.3 you add the catagory price for each image, I dread the thought of having to add the catagory price to 17000 images

My server is still not back up, but hopefully when it is you may be able to put me straight :-)


Just as an extra thought.... If the problem is the database being tripped by an excessive query count, would that mean that it won't show in coppermine debug? (edited by Mike) ;-)

Regards

Mike
« Last Edit: February 26, 2006, 10:49:51 pm by banburymike »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: There was an error while processing a database query
« Reply #5 on: February 26, 2006, 10:36:23 pm »

your host has nothing to do with this (or rather: don't expect help from that end). Enable debug mode manually by using a third-party database manipulation tool like phpMyAdmin, browse coppermine's config table and set "debug_mode" to "1".
Chose your wording more carefully, a "bug" is not the same as "debug_mode".
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #6 on: February 26, 2006, 11:06:18 pm »

your host has nothing to do with this (or rather: don't expect help from that end). Enable debug mode manually by using a third-party database manipulation tool like phpMyAdmin, browse coppermine's config table and set "debug_mode" to "1".
Chose your wording more carefully, a "bug" is not the same as "debug_mode".
Edited the B word.... sorry

Right my gallery is back up, altered "debug mode to "1"

Do you want me to post the debug output here or send it in a PM?
http://www.banburymike.net/copperminegallery/index.php



« Last Edit: February 27, 2006, 07:23:01 pm by banburymike »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: There was an error while processing a database query
« Reply #7 on: February 27, 2006, 08:27:20 am »

If your gallery is back up and running, you don't need to send anything at all. If you still experience issues, post the error message (not the debug_output) publicly (do not PM me).
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #8 on: February 27, 2006, 10:39:49 am »

If your gallery is back up and running, you don't need to send anything at all. If you still experience issues, post the error message (not the debug_output) publicly (do not PM me).
The fact that I can't post an error message is the issue (or part of it)

when I clock up an excess query count (over 50.000 in an hour) my data base server cuts me off, fair enough I suppose and not your problem :)
I am then unable to enter debug mode because the server is offline, the server resets every hour, so my gallery eventually re appears, with no errors,
My issue is that, this is a problem that has happened 5 times now,
so I'm trying to find out if this is a software or host problem,

In debug mode I notice that viewing 1 image in an album can amount to 16 database queries
(Page generated in 0.746 seconds - 16 queries in 0.685 seconds - Album set :

It doesn't take much maths to work out that, 3125 image views can produce 50.000 queries, and crash goes the server,
it is not unusual for me to get over 3000 views in an hour so I now understand why my server keeps crashing.

Now my problem is how to get this fixed..........

This is the reply that I got from my host regarding the issue....
------------------------------------------------------------------------------------------------------------------------------------------------------------
Technical Support.

The reason you are receiving that error is due to the 'max_questions' setting which is set to 50,000 per user per hour. This setting is there to ensure that the mysql database cannot be accessed to much by one user and overload the system. The connections will reset every hour and is kept by user. My suggestion to alieviate this issue is to break up your queries between multiple users which would distribute the 50,000 connection queries to multiple users.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Is setting multiple users an option? or is there another way around the problem?

I suppose I could just change host, but that would be a real pain.

Regards

Mike

Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: There was an error while processing a database query
« Reply #9 on: February 27, 2006, 10:56:53 am »

I think you just need a better server. I had 1.3x running with nearly 20k users and pics that.. with no problem at all

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #10 on: February 27, 2006, 10:59:14 am »

I think you just need a better server. I had 1.3x running with nearly 20k users and pics that.. with no problem at all
I think you may well be right Stramm  :)
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #11 on: February 28, 2006, 03:11:08 pm »

Servers gone again  :-[

Does this fix mean anything to anyone?

------------------------------------------------------------------------------------------------------------------------
My suggestion to alieviate this issue is to break up your queries between multiple users which would distribute the 50,000 connection queries to multiple users.
------------------------------------------------------------------------------------------------------------------------
Logged

Nibbler

  • Guest
Re: There was an error while processing a database query
« Reply #12 on: February 28, 2006, 03:13:46 pm »

If your limit is set to 50k per mysql user then you can create several users to distribute the load. You should be able to do this by adding code to randomly pick a db user + pass from a list in include/config.inc.php
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #13 on: February 28, 2006, 03:31:44 pm »

If your limit is set to 50k per mysql user then you can create several users to distribute the load. You should be able to do this by adding code to randomly pick a db user + pass from a list in include/config.inc.php
Thank you that sounds just what I need,

The problem,.... I have no coding knowledge,
Any chance of guiding an idiot,.... or would it be too time consuming?

Mike
Logged

Nibbler

  • Guest
Re: There was an error while processing a database query
« Reply #14 on: February 28, 2006, 03:38:55 pm »

Just something like this

Code: [Select]
<?php
// Coppermine configuration file

// MySQL configuration
$CONFIG['dbserver'] =                         'localhost';        // Your databaseserver
$CONFIG['dbname'] =                         'coppermine';        // Your mysql database name
$CONFIG['TABLE_PREFIX'] =                'cpg132_';

if (
rand(0,1)){
$CONFIG['dbuser'] =                         'user1';        // Your mysql username
$CONFIG['dbpass'] =                         'pass1';                // Your mysql password
} else {
$CONFIG['dbuser'] =                         'user2';        // Your mysql username
$CONFIG['dbpass'] =                         'pass2';                // Your mysql password
}

?>

Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #15 on: February 28, 2006, 03:44:45 pm »

Thank you Nibbler,

When my server finally resets I'll have a play with the "config.inc.php"
and see what happens  :)

Cheers!
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #16 on: February 28, 2006, 04:00:35 pm »

Nibbler
This is how my config.php looks before any mod, (password and username removed)

Quote
<?php
// Coppermine configuration file

// MySQL configuration
$CONFIG['dbserver'] =                         'localhost';        // Your database server
$CONFIG['dbuser'] =                         '****';        // Your mysql username
$CONFIG['dbpass'] =                         '****';                // Your mysql password
$CONFIG['dbname'] =                         '****_copperminegallery';        // Your mysql database name


// MySQL TABLE NAMES PREFIX
$CONFIG['TABLE_PREFIX'] =                'cpg133_';
?>

Would you mind setting me straight on where I should add the new code?  please  ;D
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: There was an error while processing a database query
« Reply #17 on: February 28, 2006, 04:54:51 pm »

You replace the content of the file.
Logged

banburymike

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 15
Re: There was an error while processing a database query
« Reply #18 on: February 28, 2006, 06:10:19 pm »

Sorry to be a pain, but If I want to add more that 2 usernames would this be right?

Quote
<?php
// Coppermine configuration file

// MySQL configuration
$CONFIG['dbserver'] =                         'localhost';        // Your databaseserver
$CONFIG['dbname'] =                         'coppermine';        // Your mysql database name
$CONFIG['TABLE_PREFIX'] =                'cpg132_';

if (rand(0,1)){
   $CONFIG['dbuser'] =                         'user1';        // Your mysql username
   $CONFIG['dbpass'] =                         'pass1';                // Your mysql password
} else {
   $CONFIG['dbuser'] =                         'user2';        // Your mysql username
   $CONFIG['dbpass'] =                         'pass2';                // Your mysql password
} else {
   $CONFIG['dbuser'] =                         'user3';        // Your mysql username
   $CONFIG['dbpass'] =                         'pass3';                // Your mysql password
} else {
   $CONFIG['dbuser'] =                         'user4';        // Your mysql username
   $CONFIG['dbpass'] =                         'pass4';                // Your mysql password
}

?>
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: There was an error while processing a database query
« Reply #19 on: February 28, 2006, 06:13:37 pm »

You can't have multiple else statements.

Code: [Select]
if (something) {
code
} else {
other code
}

If you want multiple if else

Code: [Select]
if (something) {
code
} elseif (something else) {
code
} elseif (something other) {
code
}
Logged
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots
Pages: [1] 2   Go Up
 

Page created in 0.027 seconds with 21 queries.