4

I have received this error:

[21-Jul-2016 02:14:05 America/Chicago] PHP Warning: mysqli::__construct(): (42000/1203): User s already has more than 'max_user_connections' active connections in /home/s/public_html/config.php on line 8

So, people told me to use persistent connections, so I add the p: in front of hostname:

$hostname="127.0.0.1";
$user="xxx";
$pass="123";
$bd="xxx";

$mysqli_link = new mysqli("p:$hostname", $user, $pass, $bd);

but I now have this error:

Warning: mysqli::__construct(): Persistent connections are disabled. Downgrading to normal in /home/s/public_html/config.php on line 8

any ideas?

Nikhil Vaghela
  • 2,088
  • 2
  • 15
  • 30
RGS
  • 4,062
  • 4
  • 31
  • 67
  • 1
    Which 'people' told you to use persistent connections? And why? maybe interesting? [Persistent DB Connections - Yea or Nay?](http://stackoverflow.com/questions/50303/persistent-db-connections-yea-or-nay). Timings - interesting: [Why persistent connections are bad](https://meta.wikimedia.org/wiki/Why_persistent_connections_are_bad) – Ryan Vincent Jul 23 '16 at 09:55
  • @RyanVincent could the persistent connection prevent the max_user_connections? because my host allowed only 25 mysql connections once. – RGS Jul 23 '16 at 10:11
  • 1
    Unless you have a high volume site then I suggest you go back to the standard connections. I suspect you will not notice any speed difference. Except that the connection errors will stop. ;-/ – Ryan Vincent Jul 23 '16 at 10:24

1 Answers1

0

Change the user in the sql database. Here is a link as to how you can do it.

http://php.net/manual/fr/mysqli.change-user.php

kayleighsdaddy
  • 670
  • 5
  • 15
  • mysqli with mysqlnd [do it automatically](https://dev.mysql.com/doc/apis-php/en/apis-php-mysqlnd.persist.html) – Arnial Aug 01 '16 at 13:48