php 错误:已用完允许的 67108864 字节的内存大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3887692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: Allowed memory size of 67108864 bytes exhausted
提问by meotimdihia
When I upload a picture
当我上传图片时
- File size: 375kb
- Width: 2000px
- Height: 3000px
- 文件大小:375kb
- 宽度:2000px
- 高度:3000px
I get an error
我收到一个错误
ERROR Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 2157 bytes) in...
错误致命错误:允许的内存大小为 67108864 字节用尽(试图分配 2157 字节)...
Why this happen, when 67108864 = 64MB?
为什么会发生这种情况,当 67108864 = 64MB 时?
I use a shared server. My .htaccess is:
我使用共享服务器。我的 .htaccess 是:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/ [L]
</IfModule>
where must I write php_value memory_limit 128M
?
我必须写在哪里php_value memory_limit 128M
?
回答by alex
It seems you only have 64M (67108864 / 1024 / 1024) allocated to PHP.
看来您只有 64M (67108864 / 1024 / 1024) 分配给 PHP。
If you have access to your php.ini
, increase the max memory size.
如果您有权访问您的php.ini
,请增加最大内存大小。
You can also do it in a bootstrap PHP script.
您也可以在引导 PHP 脚本中执行此操作。
ini_set('memory_limit', '128M');
Or even in your .htaccess
甚至在你的 .htaccess
php_value memory_limit 128M