-1

I set my php to this value.

upload_max_filesize 128M 
memory_limit            512M 
max_input_vars          4000
max_input_time           300 
max_input_nesting_level  64 
max_file_uploads         100
max_execution_time      3000

However, I'm still getting this error. What do I need to change?

ERROR: Database_Exception [ 2 ]: mysqli::__construct(): (08004/1040): Too many connections ~ APPPATH/kohana/modules/database/classes/Kohana/Database/MySQLi.php [ 75 ] in /home/dubizzl/public_html/oc/kohana/system/classes/Kohana/Kohana/Exception.php:110

dk-pramis
  • 109
  • 2
  • 8
  • 1
    The PHP settings you've mentioned have nothing to do with the error you're getting. – Tom Apr 25 '17 at 11:42
  • 3
    Possible duplicate of [php, mysql - Too many connections to database error](http://stackoverflow.com/questions/5040048/php-mysql-too-many-connections-to-database-error) – Marcin Orlowski Apr 25 '17 at 11:42
  • please suggestion or help? – dk-pramis Apr 25 '17 at 11:43
  • How do i check this? or able to find – dk-pramis Apr 25 '17 at 11:43
  • Do I need to contact my hosting or something? that i need to adjust on php.ini or htaccess? Thanks – dk-pramis Apr 25 '17 at 11:45
  • no, this is a problem in your code... you might have multiple `include`s for your connection code... use `require_once` – Daniel Fanica Apr 25 '17 at 11:47
  • I have a feeling that you are using your own custome db connection... why not use a library like http://medoo.in (just a suggestion) – Daniel Fanica Apr 25 '17 at 11:49
  • Show your code. If you have a class of your own, it might be that you're calling a new connection for each time you want to use the connection object, instead of saving the object as a variable, and using that multiple times. Without any code, all we can do is **guess**. And no, this has nothing to do with .htaccess or your php.ini file. – Qirel Apr 25 '17 at 11:51
  • Ok, what kind of code do you need please? – dk-pramis Apr 25 '17 at 12:04
  • The PHP code which causes this error, naturally. Read the flagged duplicate first though, I think that'll put you on the right track! Although it might be better to limit the amount of connections instead of such a "hacky" fix. Are you using a database wrapper? – Qirel Apr 25 '17 at 12:08
  • Sorry! database wrapper? please explain? – dk-pramis Apr 28 '17 at 21:08

1 Answers1

0

You have more than one connection in your code. Search all the places you're calling mysqli, you might be including your connection code more than once.

Also, on an unrelated subject, your memory_limit of 512M seems a bit high. You're doing something wrong if you have to bump that that high. That might depend on your application though so ignore if you know what you're doing.

Daniel Fanica
  • 433
  • 1
  • 4
  • 11
  • on unrelated 512m it was set by the hosting by default to me...but i can increase it if needed they said...? – dk-pramis Apr 25 '17 at 11:47
  • If you're using an e-commerce framework like `Prestashop` you might need that... as I said, it depends on your application – Daniel Fanica Apr 25 '17 at 11:51
  • The website is classified Ads so most of the time it is accessing the mysqli..i think?However if you can enlighten me on how to limit my call to mysqli? please! – dk-pramis Apr 25 '17 at 12:02
  • I would need to see your code... if you have a github repo I would gladly take a look – Daniel Fanica Apr 25 '17 at 12:10
  • What code you wanted to see?.. the home page, for example? – dk-pramis Apr 28 '17 at 21:10
  • The code where you connect to the database for starters, but a repository of the code would be better so I can find all the places it's included. – Daniel Fanica May 02 '17 at 12:18