Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Increase 'max_user_connections' in php.ini


spitlikethis

Recommended Posts

Hi

 

I've been running my oscommerce site for a couple of years now but, for the last few months, I regularly (ie a few times a day) see this message:

 

Warning: mysql_connect(): Too many connections in /homepages/2/d95939692/htdocs/smellyourmum.com/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

 

I have been told that I need to increase the 'max_user_connections' in php.ini but I cannot find php.ini!! Is this an oscommerce thing or a database thing?

 

If anyone could help, it would be great. I'm losting a lot of customers because of this.

 

I have tried to contact my hosts (1and1.co.uk) who are INCREDIBLY unhelpful and don't know where else to turn.

 

Any help gratefully received \m/

Link to comment
Share on other sites

1and1 provide a lot of webspace and bandwidth for a lesser sum of money, which is why their servers are overpacked and slow to run.

 

It's just a guess but I'd say they won't increase the max sql connections limit.

 

Only one thing worth checking yourself and that's to see if you have use_pconnect (Persistent Connections) set to true in your two configure.php files. If they are then set them to false.

 

Vger

Link to comment
Share on other sites

Thanks for that, checked it and they're already set to false. Can't see why they wouldn't increase the users - I pay extra as I go over my bandwidth allowance as it is. They have suggested I move to a dedicated server but I don't know how easy / difficult it is to reconfigure everything and move the database. I can't afford too much downtime..

Link to comment
Share on other sites

Unless you go for a fully managed dedicated server then forget the idea. You need to be a bit of an expert to run and manage your own dedicated server.

 

If you are using up your bandwidth allowance (and then some) with 1and1 then you either have a very busy and profitable website, or else your site has a problem.

 

Vger

Link to comment
Share on other sites

Look into your log files, both your 'access' and 'error' logs and they may tell you where some of the bandwidth is going. If you have some good images on your site (which someone may want to download from your site to theirs) then also look at hotlink protection (Google for 'prevent hotlinking with .htaccess').

 

Also, apply the updated osCommerce MS2 fixes, because this contains a fix to an open redirect (amongst other things).

 

Vger

Link to comment
Share on other sites

we do alright but i do think that there is bandwidth disappearing somewhere - i've tried to get 1and1 to help me out but they're not particularly interested.

 

thanks for your help

 

They wont be :(

 

I had exactly the same problem (with a different host). Thier argument was if you increase the max sql connectrion value it changes for every site, and as you probably share with several thousand sites you can imaging the impact on the server.

 

I would take vgers advice and check the logs carefully, look for get statements for images that come from a strange domain, (i found 4 last week in one of my logs.)

 

create a .htaccess file for your images directory that looks like this

 

SetEnvIfNoCase Referer "^http://www.yourdomain.co.uk/" locally_linked=1

SetEnvIfNoCase Referer "^http://www.yourdomain.co.uk$" locally_linked=1

SetEnvIfNoCase Referer "^http://yourdomain.co.uk/" locally_linked=1

SetEnvIfNoCase Referer "^http://yourdomain.co.uk$" locally_linked=1

SetEnvIfNoCase Referer "^$" locally_linked=1

<FilesMatch "\.(gif|png|jpe?g)$">

Order Allow,Deny

Allow from env=locally_linked

</FilesMatch>

 

While thats not foolproof it will go an awful long way to stopping hotlinking from your site.

 

This was one of the reasons I bought a dedicated server.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...