I surfed on Internet for past two days to create the DB pooling by PHP, but not yet achieved. I'm using PHP and MySQLi. We bought the mysqli db with 15 Maximum user connection. I want to pool the db connection to avoid the new connection. I used
persistent
as well as
mysqli_connect
. but I don't feel much different both are creating the new connection since other user already logged in. I was trying this function to get
connection.
<?php
function getConnection(){
if ($connect){
return $connect;
}else{
$connect = new mysqli('p:xxxx','yyy','zzz','aaaa');
return $connect;
if(mysqli_connect_errno($connect))
{
echo "Server Busy";
}
}
}
?>
But above function only returns the else part. Please suggest me how to handle this. Thanks in advance. For now I'm killing the process which are in sleep mode to reduce the probability of increasing DB connection.
遇到了同样的问题,在CSDN看到了,希望阿里云团队能够给出正确、标准的答案~请查看
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。