Problem :
I am getting following error in my error log file
[18-Nov-2019 19:09:55 UTC] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1040] Too many connections' in /home/root/products/db.php:2
Stack trace: /home/root/products/db.php(2): PDO->__construct('mysql:host=loca...', 'database', 'password')
/home/root/products/by-brand.php(2): include_once('/home/root/...')
{main} thrown in /home/root/products/db.php on line 2
[18-Nov-2019 19:15:11 UTC] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1286 Unknown storage engine InnoDB in /home/root/products/detail.php:8
Stack trace: /home/root/products/name.php(8): PDO->prepare('select * from p...')
{main} thrown in /home/root/products/name.php on line 8
I have tried to solve this issue by closing every script by using $db=null; but it is not working for me.
I also contacted the service provider.
Why am I getting this error?
My db.php file has following code. Can you tell if this is fine?
My db.php as follows:
$db = new PDO('mysql:host=localhost;dbname=mobiles;charset=utf8', 'root', '**somePassword**');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);