![]() |
|
[PHP] error message - too many connections |
count
Member #5,401
January 2005
|
From time to time I get this error message when I try to go to my site which has acces to my database. (all pages on my site): Warning: mysql_connect(): Too many connections in /srv/www/htdocs/webxxx/html/xxx.php on line 6 Why is this happening? And is there anything I can do about it? Thanks in advanve for your advice!
|
GullRaDriel
Member #3,861
September 2003
![]() |
from http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html A.2.6. Too many connections If you get a Too many connections error when you try to connect to the mysqld server, this means that all available connections are in use by other clients. The number of connections allowed is controlled by the max_connections system variable. Its default value is 100. If you need to support more connections, you should restart mysqld with a larger value for this variable. mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected. See Section 13.5.4.19, SHOW PROCESSLIST Syntax. The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform. Linux or Solaris should be able to support 500-1000 simultaneous connections, depending on how much RAM you have and what your clients are doing. Static Linux binaries provided by MySQL AB can support up to 4000 connections. "Code is like shit - it only smells if it is not yours" |
count
Member #5,401
January 2005
|
Thank you. Are there errors in my script? I do NOT use persistent connections.
|
Derezo
Member #1,666
April 2001
![]() |
Make sure you're closing your connections when you're done with them. Otherwise you may be leaving a bunch of dead connections open. Happened to me in a C# site I was working on. Of course, Microsoft doesn't give you a nice relevant error like that. [edit] Quote:
Is it possible that a missing close of a connection can lead to this problem? Could be either. "He who controls the stuffing controls the Universe" |
count
Member #5,401
January 2005
|
Ok. Thanks. I thought I closed everything. This didn´t happen for quite a while. [edit]
|
GullRaDriel
Member #3,861
September 2003
![]() |
Quote: I probably can´t do anything about this error, right? "If you need to support more connections, you should restart mysqld with a larger value for this variable." If you can't, you are right. You can't do anything else than asking your FAI to upgrade the number of connection, ask him if connection are also mutuals and my bad, I think it's all. "Code is like shit - it only smells if it is not yours" |
count
Member #5,401
January 2005
|
The site has been down a few times today. If I want to change hosts is it possible to keep my internetadress? The Hosting service registered it for me so I doubt that it is possible but that would be very uncool because I have to give up the adress when I decide to change hosts.
|
Matthew Leverton
Supreme Loser
January 1999
![]() |
If it's in their name, there's nothing you can do but ask them politely. Keep in mind with webhosting, you get what you pay for. A few dollars per month usually means you are on an overloaded server or with a company that is run out of a 15 year old's basement. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Quote: or with a company that is run out of a 15 year old's basement. Or the 15yr olds company is hosted in a crappy datacenter with a crappy version of Fedora installed. -- |
BAF
Member #2,981
December 2002
![]() |
Hey, I'm 16 and its RedHat. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Hey, you were 15, and RedHat is worse than fedora since RedHat is old and unmaintained -- |
GullRaDriel
Member #3,861
September 2003
![]() |
"Code is like shit - it only smells if it is not yours" |
BAF
Member #2,981
December 2002
![]() |
I'd prefer Gentoo or similar, but I don't have much of a choice (considering I use plesk, there are no good free alternative to plesk, so I'm locked to which distros Plesk supports through my ISP as my ISP must install it). |
|