在 PHP 中动态生成图像有时不起作用

发布于 2024-08-23 01:00:24 字数 137 浏览 6 评论 0原文

我有一个页面需要加载几个动态生成的图像。 90% 的时间一切正常,但有时某些图像未生成(我只是得到了丢失的图像图标)。由于大多数时候它都有效,并且丢失的图像并不总是相同,我认为这可能与服务器没有足够的资源有关。有什么方法可以防止这种情况发生(并确保生成图像)?

I have a page that needs to load several dynamically generated images. Everything works fine 90% of the time, but sometimes some of the images are not generated (I just get the missing image icon instead). Since most of the times it works, and the missing images are not always the same, I think that maybe it has something to do with the server not having enough resources. Are there any ways I can prevent this from happening (and make sure the images get generated)?

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

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

发布评论

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

评论(1

空城之時有危險 2024-08-30 01:00:24

我会尝试提高 PHP 的内存限制和超时并重新启动您的 Web 服务器。特别是,请查看 memory_limit 和 max_execution_time。

另外,在该配置文件中,查看output_buffering,它控制发送之前可以在内存中构建多少输出。这有时会影响标题之前可以输出的数量。

我假设您已经查看了日志文件,但我建议围绕图像生成语句编写调试,以查看它们是否返回。

I would try upping the memory limits and timeouts of PHP and restart your web server. In particular, look at memory_limit and max_execution_time.

Also in that configuration file, look at output_buffering, which controls how much of the output can be built up in memory before sending. This can sometimes affect how much can be output before the headers.

I assume you've already looked at your log files, but I would recommend writing out debugging around the image generation statements to see if they're returning or not.

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