Search Posts on Binpipe Blog

MYSQL 'Already has more than max_user_connections' & 'Cannot send session cache limiter' Issue & Solution

MYSQL 'Already has more than max_user_connections' & 'Cannot send session cache limiter' Issue & Solution is discussed below. Hope this helps.


ISSUE:
Warning: mysqli_real_connect(): (42000/1203): User sphn_vtig1 already has more than 'max_user_connections' active connections in /home/sphn/public_html/vt_vb/libraries/adodb/drivers/adodb-mysqli.inc.php on line 123

SOLUTION:

Solution could be any of the following:

1.  Use separate DB user to connect to vtiger and to connect the script that imports data every few minutes. This way each user will use its own connection limit.  Also, check that the connection is closed by the script after it inserts data. If not close it otherwise it will open too many connections till the timeout value is reached.


2. Try the following if you have root access to the server, or let me know. You can call me anytime if any help is needed.

The option max_user_connections is a limit imposed, not on the total number of simultaneous connections in the server instance, but on the individual user account.

Let's say the user is called db_user@localhost. You can find out what this user's connection limit is. Start by running this query:

SELECT max_user_connections FROM mysql.user
WHERE user='db_user' AND host='localhost';
If this is a nonzero value,change it back with

GRANT USAGE ON *.* TO db_user@localhost MAX_USER_CONNECTIONS 0;
or

UPDATE mysql.user SET max_user_connections = 0
WHERE user='db_user' AND host='localhost';
FLUSH PRIVILEGES;

This will cause mysqld to allow the user db_user@localhost to use the global setting max_user_connections as its limit.

Once you get to this point, now check the global setting using

SHOW VARIABLES LIKE 'max_user_connections';

If this is a nonzero value, you need to do two things

THING #1 : Look for the setting in /etc/my.cnf

[mysqld]
max_user_connections = <some number>
comment that line out

THING #2 : Set the value dynamically

SET GLOBAL max_user_connections = 0;

MySQL restart is not required.


ISSUE
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/sphn/public_html/vt_vb/libraries/adodb/drivers/adodb-mysqli.inc.php:123) in /home/sphn/public_html/vt_vb/libraries/HTTP_Session/Session.php on line 161

SOLUTION:

"Headers already sent" means that your PHP script already sent the HTTP headers, and as such it can't make modifications to them now.

Just make session_start the first thing you do in your PHP file. 
Put <?php session_start(); ?> above everything and it will work.

No comments:

Post a Comment

Hi, Leave a comment here and one of the binary piper's will reply soon :)