I am trying to run a php file through shell script multiple times.
I open connection like this (index.php).
mysqli_connect('localhost', 'root', 'password', 'database')
I got following error
mysqli_connect(): (HY000/1040): Too many connections
I could increase max_connections
in mysql my.cnf
file. But I think this is not a good idea because it slows things down.
Here is my .sh file code when I run. It hits php file 750 times
#!/bin/bash
max=750
for i in `seq 0 $max`
do
php index.php $i &
done
Can I share one connection across a file when it is hit simultaneously? Or is there any better approach?
Any Help?