PHP 致命错误:内存不足(已分配 1707606016)(尝试分配 426680697 字节) [英] PHP Fatal error: Out of memory (allocated 1707606016) (tried to allocate 426680697 bytes)

查看:34
本文介绍了PHP 致命错误:内存不足(已分配 1707606016)(尝试分配 426680697 字节)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 DigitalOcean 上有一个 Droplet,它是一个 10 美元的套餐和 1GB 内存,然后我升级到了 20 美元的套餐.

I have a droplet on DigitalOcean, it was a 10$ package with 1GB Memory, then I upgraded to 20$ package.

所以这一切是如何开始的,我正在尝试使用 cURL 参数将文件从一台服务器上传到另一台服务器,现在的问题是...文件没有发送,因为我收到了这个美丽的错误.

So how it all started was that I'm trying to upload a file from one server to another using cURL parameters, now the issue is... The file doesn't send because I get this beautiful error.

PHP Fatal error:  Out of memory (allocated 1707606016) (tried to allocate 426680697 bytes)

现在我将 memory_limit 设置为 2048MB,因为这是我在 VPS 上获得的内存量.现在升级之前,我只有1024MB的内存,而且当时的错误信息不同,这就是我得到的.

Now I have memory_limit set to 2048MB because that's how much MB of memory I got on my VPS. Now before I upgraded, I had only 1024MB of memory and the error message was different at the time, and this is what I got.

PHP Fatal error:  Out of memory (allocated 530055168) (tried to allocate 529639729 bytes) 

我的 VPS 有足够的内存来上传 403MB 的文件,而且我的 memory_limit 已达到最大值,我无法升级服务器内存限制.

My VPS has MORE than enough memory to upload a 403MB file, and I have my memory_limit maxed, there's no way I need to upgrade the servers memory limit.

memory_limit = 2048M
file_uploads = On
upload_max_filesize = 5000M
max_file_uploads = 20
allow_url_fopen = On
post_max_size = 0
max_execution_time = 90000
max_input_time = 90000

显然它可能看起来像重复,但我看过的所有帖子的解决方案对我有用.具有 memory_limit 的脚本实际上是一个处理程序,用于处理从备用服务器发送的 cURL 请求.

Obviously it may look like a duplicate, but the solutions on all of the posts I've looked at don't work for me. The script that is having its memory_limit is literally a handler that handles the cURL request sent from the alternative server.

推荐答案

你可以更改 php.ini

You can changed the php.ini

memory_limit = -1

并添加到httpd.conf并重启Apache

and add to httpd.conf And restart Apache

这篇关于PHP 致命错误:内存不足(已分配 1707606016)(尝试分配 426680697 字节)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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