homepage Welcome to WebmasterWorld Guest from 174.129.74.186
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Ecommerce
Forum Library, Charter, Moderators: buckworks

Ecommerce Forum

    
Getting a Max connections error in an Oscommerce store
cmendla




msg:3753986
 10:40 pm on Sep 28, 2008 (gmt 0)

We have an oscommerce site that is locking up with a

Warning: mysql_connect() [function.mysql-connect]: User mysite has already more than 'max_user_connections' active connections in /home/mysite/public_html/ZZZZZ//includes/functions/database.php on line 19
Unable to connect to database server!

We are on shared hosting. We recently had some custom coding added which may be causing some of the problem.

We got the following response back from our host

There are many reasons this could be happening. They are:
* Your website is getting busy for this server, resulting in too many simultaneous connections/processes running.
* Your script is not exiting after execution, resulting in "zombie" / stale processes.
* You have a look/runaway process.

---------------
Sun Sep 28 00:03:48 2008: mysite running 16 processes
Sun Sep 28 00:12:04 2008: mysite running 17 processes
Sun Sep 28 13:51:32 2008: mysite running 16 processes
Sun Sep 28 14:56:12 2008: mysite running 17 processes
Sun Sep 28 14:57:03 2008: mysite running 18 processes
Sun Sep 28 14:58:40 2008: mysite running 17 processes
Sun Sep 28 15:00:02 2008: mysite running 16 processes
Sun Sep 28 15:02:25 2008: mysite running 16 processes
------------------------------------------------------------

What I suggest doing is adding an "exit(0);" to the bottom of all your PHP scripts to assure the script exits and doesn't dwell around.
If this is still a problem, you'll need to look into the code and see if you can improve in areas.

I have a php.ini file in the root of the store. I believe it does get read. Here are some of the lines in it

-------------------------------------------------------------------------------------
; Allow or prevent persistent links.
odbc.allow_persistent = On

; Check that a connection is still valid before reuse.
odbc.check_persistent = On

; Maximum number of persistent links. -1 means no limit.
odbc.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
odbc.max_links = -1

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

; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = 50

; Maximum number of links (persistent + non-persistent). -1 means no limit.
mysql.max_links = 500

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

My Questions.

1. I believe our host has set the max connections to something like 10 or 15. Is this adequate for a site where we can expect a couple of hundred page views per day. ?
2. For OS Commerce, what would be a reasonable number of max connections?
3. Am I correct in that we would need about 1 connection per logged on visitor?
4. I checked the configure.php and the pconnect setting was set to false for both the admin and the store.
5. Would the exit(0) help. I think that would be unwieldy to try to add to all the php files in oscommerce.
6. I copied part of the php.ini file that is in the root of the store. Is there anything in there that could be tweaked for connections.

I'm beginning to think we might need to move to another host or perhaps a dedicated server.

I'd really appreciate any thoughts or comments.

Thanks
chris

 

bwnbwn




msg:3754084
 1:19 am on Sep 29, 2008 (gmt 0)

I doubt it is the host as a 200 page views a day is not something that could even put a strain on a server.

I would look at the new code as this didn't happen until you added the code it would be my firt look then examine the host and how many connections you have.

Find out how many sites there are on this server and take a look at the usuage your using.

I think they are saying your not closing the connections and they are staying open causing the error.

sun818




msg:3754679
 5:11 pm on Sep 29, 2008 (gmt 0)

Yup, with any new code changes you include - you also need to have a rollback strategy in place for situations like this. Roll it back and if the problem goes away - it was custom code. It wouldn't hurt to get a second opinion on the custom code in case the first programmer is incompetent.

xalex




msg:3755327
 6:56 am on Sep 30, 2008 (gmt 0)

You need to change this setting when database starts, edit my.cnf file.

axgrindr




msg:3759243
 8:04 pm on Oct 5, 2008 (gmt 0)

I had this same error on two of my sites and simply raised the max connections in php.ini to get rid of it.

I'm beginning to think we might need to move to another host or perhaps a dedicated server.

You should definitely do this. Ecommerce on a shared host is not an ideal setup.

pbradish




msg:3759423
 3:23 am on Oct 6, 2008 (gmt 0)

I had this same error on two of my sites and simply raised the max connections in php.ini to get rid of it.

Same here. Have you tried oscommerce specific forums?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Ecommerce
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved