当前位置:Gxlcms > PHP教程 > 网站出现内存用尽(error:Allowedmemorysizeof134217728bytesexhausted(triedtoall)

网站出现内存用尽(error:Allowedmemorysizeof134217728bytesexhausted(triedtoall)

时间:2021-07-01 10:21:17 帮助过:15人阅读

出现问题:
[Thu Jul 09 09:57:22 2015] [error] [client 183.61.51.179] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4294967296 bytes) in /vhost/vhostroot/wart8555/www/class/companyInfomation.php on line 80
[Thu Jul 09 09:57:48 2015] [error] [client 59.57.252.98] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4294967296 bytes) in /vhost/vhostroot/wart8555/www/class/companyInfomation.php on line 80
[Thu Jul 09 09:57:50 2015] [error] [client 59.57.252.98] File does not exist: /vhost/vhostroot/wart8555/www/favicon.ico
[Thu Jul 09 10:01:38 2015] [error] [client 59.57.252.98] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4294967296 bytes) in /vhost/vhostroot/wart8555/www/class/companyInfomation.php on line 80
首先index.php中引用foot.php页面,里面出现了问题,初学PHP,请大神帮忙看下
indexShow();$information = new BaseInformation();$infor_list = $information->findPage(1, 5);?><?php echo WEB_TITLE;?>                      						        

新闻

  • ">

详情


getContent();?>

Placerat urna et tristique in! Scelerisque integer nisi pha sellus, nec phasellus arcualiquet etiam magna massa sit cursus adipiscing sed, nec? Aenean odio! Cumac dolor dapibus tincidunt lorem ipsum dolor sit esmet placerat urna et tristique in! Scelerisque integer nisi phasellus

id = $id;	}	function getId(){		return $this->id;	}	function setInfomation($infomation){		$this->infomation = $infomation;	}	function getInfomation(){		return $this->infomation;	}	function setAddr($addr){		$this->addr = $addr;	}	function getAddr(){		return $this->addr;	}	function setTel($tel){		$this->tel = $tel;	}	function getTel(){		return $this->tel;	}	function setFx($fx){		$this->fx = $fx;	}	function getFx(){		return $this->fx;	}	function setEmail($email){		$this->email = $email;	}	function getEmail(){		return $this->email;	}		function edit(){		$select_sql = "select id from company_information where id = ?";		$insert_sql = "insert into company_information (information,addr,tel,fx,email)values(?,?,?,?,?)";		$update_sql = "update company_information set information = ?,addr=?,tel=?,fx=?,email=? where id=?";		$database = new Database();		$conn = $database->getConn();		$stmt = $conn->prepare($select_sql); 		$stmt->bind_param('i',$this->id); 		$stmt->execute(); 		$stmt->bind_result($id);				$stmt_edit = null;		if($stmt->fetch()){			$stmt_edit = $conn->prepare($update_sql); 			$stmt_edit->bind_param("sssssi",$this->infomation,$this->addr,$this->tel,$this->fx,$this->email,$this->id);			$stmt_edit->execute();		}else{			$stmt_edit = $conn->prepare($insert_sql);			$stmt_edit->bind_param("sssss",$this->infomation,$this->addr,$this->tel,$this->fx,$this->email);			$stmt_edit->execute();		}		$stmt->close();		$stmt_edit->close();		$conn->close();	}		function getContent(){		$select_sql = "select id,information,addr,tel,fx,email from company_information limit 0,1";		$database = new Database();		$conn = $database->getConn();		$stmt = $conn->prepare($select_sql); 		$stmt->execute();		$stmt->bind_result($id,$information,$addr,$tel,$fx,$email);		$infomation_obj = null;		if ($stmt->fetch())		{			$infomation_obj = new CompanyInfomation();			$infomation_obj->setAddr($addr);			$infomation_obj->setEmail($email);			$infomation_obj->setFx($fx);			$infomation_obj->setId($id);			$infomation_obj->setInfomation($information);			$infomation_obj->setTel($tel);		}		$stmt->close();		$conn->close();		return $infomation_obj;	}}?>


回复讨论(解决方案)

内存不足,在报错前那行,打印下所有变量、参数,是不是过大了。

哪个是 companyInfomation.php ?

看不出哪里需要 4G 的内存

没看到需要4G内存的地方。

哪个是 companyInfomation.php ?

看不出哪里需要 4G 的内存

最后一个是

内存不足,在报错前那行,打印下所有变量、参数,是不是过大了。

第一个104行,第二个3-5行,第3个的80

没看到需要4G内存的地方。

数据库查询最多一条数据,没有数据也会报这样的错

虽然 bind_result 方法不需要参数变量事先存在,但是你还是先声明一下比较妥当
$id = $information = $addr = $tel = $fx = $email = ‘’;
$stmt->bind_result($id,$information,$addr,$tel,$fx,$email);

虽然 bind_result 方法不需要参数变量事先存在,但是你还是先声明一下比较妥当
$id = $information = $addr = $tel = $fx = $email = ‘’;
$stmt->bind_result($id,$information,$addr,$tel,$fx,$email);

还是不行

你试一下不用 bind_result 是怎样的

谢谢各位回答,字段类型设置错误,一个大文本字段设置成为最大字段,需要内存4G,换了就好了

人气教程排行