允许的内存大小 67108864 字节已用完上传照片时出现错误

发布于 2024-12-09 05:06:14 字数 436 浏览 0 评论 0原文

我的网站有一点问题。

人们使用此页面在我的网站上创建帖子,您可以在其中附加照片。 除了那一张之外,所有照片都有效。 (请参阅下面的链接)

当我尝试在“帖子”页面上上传它时,它会显示:

我的女朋友是正在尝试上传它的人,在上传之前她使用 Windows 7 旋转图片(在预览模式下),所以图像将位于右侧。

PHP 致命错误:允许内存大小 67108864 字节耗尽(尝试分配 3411201 字节)在 /home/(路径的其余部分)/upload.php 第 65 行

upload.php = $tmp=imagecreatetruecolor($newwidth,$新高度);

我两天来一直在寻找一种“应对”该错误的方法。

有人可以帮我吗?

它只显示该图像的错误,我不知道旋转是否是问题所在......

非常感谢

I have a little problem with my website.

People use this page to create a post on my site, you can attach photos to it.
All photos were working ecept that one. ( see below for the link )

When I try to upload it on the "post" page it says:

My girlfriend is the one that is trying to upload it , before uploading it she rotate the picture with windows 7 ( in preview mode ) so the image would be on the right side.

PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 3411201 bytes) in /home/(rest of path)/upload.php on line 65

line 65 on upload.php = $tmp=imagecreatetruecolor($newwidth,$newheight);

I've been looking for a way to "counter" that error for 2 days.

Can anybody help me please?

It only show that error with that image, I don't know if the rotate is the problem...

Thank you very much

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

罗罗贝儿 2024-12-16 05:06:14

问题是您的脚本内存不足。现在看来每个 PHP 脚本分配了约 64mb。令人惊奇的是它使用的不仅仅是这个(除非您上传巨大的照片!),但是当您将以下内容放在脚本的顶部时会发生什么?

ini_set('memory_limit', '128M');

这将暂时提高该脚本的内存限制。如果您发现需要为脚本分配更多内存,并且不想使用 ini_set(),则必须更改 php.ini 中的值。

它能工作还是内存不足~128mb?


NOTE:
If this is a personal project, this solution is ok. If this is something bigger than that, I would take matino's advice and limit your upload size.

The problem is your script is running out of memory. Right now it seems that you have ~64mb allocated per PHP script. It is amazing that it is using more than that (unless you are uploading huge photos!), but what happens when you put the following at the top of your script?

ini_set('memory_limit', '128M');

This will raise the memory limit temporarily for that script. If you find that you need to allocate more memory for your script, then you'll have to change the value in php.ini if you don't want to use ini_set().

Does it work or does it run out of memory ~128mb?


NOTE:
If this is a personal project, this solution is ok. If this is something bigger than that, I would take matino's advice and limit your upload size.

青衫儰鉨ミ守葔 2024-12-16 05:06:14

尝试使用较小的照片或增加 php.ini 中的内存限制

在 php.ini 中:
像这样更改 memory_limit 的值:
内存限制 = 258M
重新启动网络服务器。

Try to use smaller photo or increase your memory_limit in php.ini

In php.ini:
change value of memory_limit like this:
memory_limit = 258M
Restart web server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文