PHP 7.1致命错误:允许的内存大小为268435456字节已用尽

问题描述 投票:0回答:1

PHP版本7.1我正在尝试创建一个页面,任何用户都可以在其中上传图片,他们的姓名,评论和他们的电子邮件。在网页上,只会显示用户名,评论和他们上传的图像。我不确定这是否有帮助,但是我正在使用Hostgator mysql数据库存储所有数据。在先前的问题中(在此网站上PHP Warning mysqli_fetch_assoc()),我在获取和获取语句时遇到错误。但是,其中一种解决方案解决了该问题,但可悲的是,现在我收到警告说:

致命错误:允许以268435456字节耗尽内存(尝试分配4294967296字节)第45行的gallery.php

我在该网站上查找了关于同一问题的另一篇文章,我一直在尝试按照这些步骤进行操作,但未成功。如果有人可以指导我解决此问题,我将不胜感激。提前致谢。

它所指的代码:

<div class="gallery-container">
<?php
include_once 'includes/dbh.inc.php';

$sql = "SELECT imgFullNameGallery, titleGallery, descGallery FROM gallery ORDER BY orderGallery 
DESC;";

$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
echo "SQL statement failed!";
} else {

mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $imgFullNameGallery, $titleGallery, $descGallery);


while (mysqli_stmt_fetch($stmt)) {
echo '<a href="#">
<div style="background-image: url(img/gallery/'.$imgFullNameGallery.');"></div>
<h3>'.$titleGallery.'</h3>
<p>'.$descGallery.'</p>
</a>';
}
}
mysqli_stmt_close($stmt);
mysqli_close($link);
?>
</div>
php mysql database
1个回答
0
投票

尝试在您的php.ini中使用此行ini_set('memory_limit', '256M')

© www.soinside.com 2019 - 2024. All rights reserved.