PHP Mysqli永久连接错误 [英] Php Mysqli Persistent connection error

查看:45
本文介绍了PHP Mysqli永久连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的脚本中有时会出现一个问题,通常是我将其放置一段时间(例如5-10分钟)而没有请求时会出现此错误:

I have a problem in my script that appen sometimes,usually when i leave it for some time(like 5-10 minutes)without requests i get this error:

警告:mysqli_connect()[function.mysqli-connect]:MySQL服务器已在第30行的FILE.php中消失

这是给我错误的代码是这样的:

and this is the code that gives me error is this:

$ this-> db = mysqli_connect('p:'.$ this-> db_host,$ this-> db_user,$ this-> db_pwd,$ this-> db_name);

$this->db=mysqli_connect('p:'.$this->db_host,$this->db_user,$this->db_pwd,$this->db_name);

该代码包含在一个单例类中,我目前正在使用

The code is contained on a singleton class and i'm currently developing on windows7 with

  • Apache 2.2.11
  • MySQL 5.1.36
  • PHP 5.3.0

(我使用WampServer 2.0i),但是显然我将在最终服务器上使用linux.

(i use WampServer 2.0i)but i'll obviously use linux on the final server.

谢谢.

推荐答案

简单... PHP 5.1不支持

It easy... PHP 5.1 doesn't support it

http://php.net/manual/en/mysqli.persistconns.php

需要PHP 5.3

这篇关于PHP Mysqli永久连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆