Post by doremi » Fri Dec 03, 2010 11:51 am

Hi all,

I'm in dire need of help here. I received the following error msg when accessing my site (opencart 1.4.7):

Warning: mysql_connect() [function.mysql-connect]: User xxxxx already has more than 'max_user_connections' active connections in /home2/xxxx/public_html/system/database/mysql.php on line 6
Error: Could not make a database connection using xxxx@localhost
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /home2/xxxx/public_html/system/database/mysql.php on line 66

Contacted my web hosting and they say my site is exceeding the maximum number of mysql connections which is 15 and that my site has to be optimized so that it does not try to open more than 15. He says I can probably reduce it by implementing some server-side caching for your site.

With no programming background whatsoever, can anyone advise how I can do that? Or what would be the best solution to this problem? Change to a better hosting? Hire a developer to look into it? It's peak season now and with this problem, I'm losing a lot of customers with intermittent downtime recorded yesterday for several hours combined using an uptime monitor service. PLEASE HELP! Urgent! Thank you!!

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by i2Paq » Fri Dec 03, 2010 2:17 pm

Always include a link if you are having a store front issue!
It could be that you modfied your template or core code and hat there is a sort of loop that connects to you MySQL and uses up all your MySQL connections.

Without a link to your site no-one can tell.

You can also ask your hoster to have a look at it.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by doremi » Fri Dec 03, 2010 7:09 pm

Thank you for your reply. It's working fine at this moment and has been so for the past 5 months until yesterday. I have not modified the template nor the core code since 3 months ago so I don't think it's the reason. I guess it happens when the traffic is high, as pointed out by my hoster.

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by i2Paq » Fri Dec 03, 2010 7:55 pm

doremi wrote:I guess it happens when the traffic is high, as pointed out by my hoster.
This would mean you need to upgrade your hosting-plan.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by doremi » Fri Dec 03, 2010 8:12 pm

looks like it...but the hoster does not have an upgrade plan which means I have to move my site to a new hosting...sigh! by the way, is the maximum number of mysql connections 15 very low/low/average by industry standard? for 1000 unique/day, do you have any idea what would be an ideal limit so that I can scout for a hosting that can meet my requirement? It's ridiculous that hosting companies give unlimited bandwidth/space but such limited mysql connection, and it's not mentioned in their spec.

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by doremi » Fri Dec 03, 2010 9:48 pm

I'm wondering...is there a possibility that the site is hacked or something? i have a bad feeling.

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by doremi » Sat Dec 04, 2010 9:16 am

I don't know if this is related. I tried to access the error logs and I got this:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 522734017 bytes) in /home2/*****/public_html/admin/controller/tool/error_log.php on line 43

Also, when I try to backup the database (during the time my website is loading without problem), it takes a very long time, and causing the website to load very slowly. Is this normal?

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by Xsecrets » Sat Dec 04, 2010 9:36 am

if you have lots of data in your database yes that is normal.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by doremi » Sat Dec 04, 2010 10:28 am

OK. Is it also normal that i have problem downloading my error logs because i have lots of data?

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by JAY6390 » Sat Dec 04, 2010 10:57 am

15 max connections for that kind of traffic is very poor imo. You should be using around 100 at least really. As for the memory issue, as Xsecrets has pointed out, it's because the error log is so big. Delete it (or get your php config to allow a bigger memory allocation)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by doremi » Sat Dec 04, 2010 5:13 pm

Noted. Thank you. I've found one that has unlimited connections. The other few non-dedicated/non vps hosting that I asked have 10 to 25 max connections. Looks like that's pretty standard so I wonder do a lot of ppl face max connection exceeded issue because I don't think 1000 unique/day is rare. I only got to know about this kind of limit two days ago in an unpleasant way.

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by doremi » Sat Dec 04, 2010 6:34 pm

Jay, do you have a recommendation for web hosting? I just learned that although Arvixe has no maximum mysql connections, it has a limit to simultaneous processes...which is, imho, equivalent to max mysql connection. haha!

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by JAY6390 » Sat Dec 04, 2010 7:43 pm

I host myself, that way I have full control over the server - without a vps/dedicated you are going to struggle with this kind of thing I'm afraid. If you're getting that kind of traffic, you should think of the bigger picture, over time most people's server demand grows from customers, and at 1000 hits a day, you should have a vps at the least. Shared hosting just won't cut it. The reason you had the max connections is because your hosting provider needs to limit you in order to give all of the other thousands of people they bunch onto the shared server a chance to use the db as well

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Xsecrets » Sat Dec 04, 2010 10:05 pm

A vps at a 1000 hits a day? you're kidding right? I see no reason why shared hosting shouldn't be able to handle 5-10 times that. I mean honestly when you think about how many minutes there are in a day and how fast a properly configured server handles requests you generally wouldn't ever have more that two maybe three simultaneous operations at any time during the day. Though I think 15 is a bit low it is very surprising that a 1000 hit a day website hit that limit if there are no other problems, though the fact that the error log is too big to backup would lead me to believe there are some other issues at play here.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by doremi » Sat Dec 04, 2010 11:38 pm

JAY6390 wrote:it's because the error log is so big. Delete it (or get your php config to allow a bigger memory allocation)
Can you please advise how i can configure to allow bigger memory allocation for the error log? If it's true like Xsecrets pointed out, perhaps I can find the source of the problem from the log. Thank you.

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by Xsecrets » Sat Dec 04, 2010 11:43 pm

you generally can't change the memory allocation limits on shared hosting. Really you should look in the error log and see what the problem is then fix it and clear the log.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by doremi » Sun Dec 05, 2010 1:24 am

How can i view and clear the error log? I can't download it in the admin. can i download it with ftp? if so, where is the location? TQ.

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by JAY6390 » Sun Dec 05, 2010 2:04 am

The error log will be in /system/logs/log.txt

@xsecrets - A VPS really isn't all that more expensive than shared hosting, and allows you far more freedom - for the 1000 hits, if it's 1000 unique visitors (which is what I was assuming) then it's really not all that unlikely that a server would go over 15 users at once, and there are obviously times in the day where traffic is "bunched together" as it were, during peak times

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by doremi » Sun Dec 05, 2010 1:02 pm

Have finally managed to take a look at my error log and it consists of an endless list of:
PHP Notice: Undefined variable: action in /home2/*****/public_html/catalog/view/theme/default/template/product/category.tpl on line 67

This is the line where I pasted the code to add "add to cart" and "View Options" button on catalog product list found here http://forum.opencart.com/viewtopic.php ... 97&p=63356 with this code

Code: Select all

<?php if (!$products[$j]['options']) { ?>
<form action="<?php echo $action; ?>" method="post" id="product_<?php echo $j;?>">
<input type="hidden" name="quantity" size="3" value="1" />
<a onclick="" id="add_to_cart_<?php echo $j;?>" rel="<?php echo $j;?>" class="button add_to_cart"><span>Add to Cart</span></a>
<input type="hidden" name="product_id" value="<?php echo $products[$j]['id']; ?>" />
</form>
<?php } 
else { ?>
<a class="button" style="text-decoration:none;" href="<?php echo $products[$j]['href']; ?>"><span>View Options</span></a>
<?php } ?>
This was done in 4 months ago and it's not giving me any problem on the front-end...so should i be alarmed? I don't know how to correct this other than to remove it if it's harmful. Thks.

New member

Posts

Joined
Thu May 13, 2010 11:58 pm

Post by Xsecrets » Sun Dec 05, 2010 1:35 pm

and you say it's working? I don't see how since the action variable tells it where to post the form data and if it's undefined I'm not really sure how it's actually working.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US
Who is online

Users browsing this forum: No registered users and 16 guests