php 已用完 268435456 字节的允许内存大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3903363/
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
Allowed memory size of 268435456 bytes exhausted
提问by Pennywise83
Possible Duplicate:
Allowed memory size of X bytes exhausted
可能的重复:已
用完 X 字节的允许内存大小
I'm handling with a quite little big database (87mb) import and to do that I use a php script. All the operations are made in locale with an apache installation on Ubuntu Lucid.
我正在处理一个相当小的大数据库(87mb)导入,为此我使用了一个 php 脚本。所有操作都是在 Ubuntu Lucid 上安装 apache 的语言环境中进行的。
When I run the script after few minutes I receive this error:
几分钟后运行脚本时,我收到此错误:
Allowed memory size of 268435456 bytes exhausted
I've changed memory_limit
to 2GB in php.ini file and restarted apache. After that I've checked phpinfo()
and I see that memory_limit
is set to '2048M' so all is ok.
我memory_limit
在 php.ini 文件中更改为 2GB 并重新启动了 apache。之后我检查过phpinfo()
,我看到它memory_limit
被设置为“2048M”,所以一切正常。
But when i relaunch my script i receive the same error, 256mb memory limit exahusted.
但是当我重新启动我的脚本时,我收到了同样的错误,256mb 内存限制 exahusted。
Where am I wrong?
我哪里错了?
回答by Jsventer
If the script you are using is borrowed from someone else make sure there is no ini_set('memory_limit', '256M')
which would produce the exactly effect you are seeing in spite of any change you made in php.ini.
如果您使用的脚本是从其他人那里借来的,请确保没有任何脚本ini_set('memory_limit', '256M')
会产生您所看到的效果,尽管您在 php.ini 中进行了任何更改。
回答by Vid Luther
Ubuntu has two php.ini's, one for apache and one for cli.
Are you sure you edited the right one?
The one for command line is usually in /etc/php5/cli/php.ini
.
Ubuntu 有两个 php.ini,一个用于 apache,一个用于 cli。
你确定你编辑的是正确的吗?
命令行的一个通常在/etc/php5/cli/php.ini
.
回答by Levon Mirzoyan
Most probably wrong php.ini is used.
很可能使用了错误的 php.ini。
In the same phpinfo()
-s output you can check what file is used exactly, search for "Configuration File".
在相同的phpinfo()
-s 输出中,您可以检查确切使用的文件,搜索“配置文件”。
You can call the phpinfo()
function from your real script used, to be sure to get the settings for exactly your script (different settings can be used for different virtual hsots, paths, etc).
您可以phpinfo()
从您使用的真实脚本中调用该函数,以确保获取您脚本的设置(不同的设置可用于不同的虚拟 hsot、路径等)。