致命错误:允许的内存大小 67108864 字节已耗尽
我有一个脚本在特定服务器上让我头疼。
我不断收到此错误:
致命错误:允许的内存大小为 67108864 字节耗尽
即使我已将 php.ini 编辑为:
max_execution_time = 300 ; Maximum execution time of each script, in seconds
max_input_time = 600 ; Maximum amount of time each script may spend parsing request data
memory_limit = 96M ; Maximum amount of memory a script may consume (16MB)
67108864 字节限制来自哪里?
I've got a script that's giving me headaches on a particular server.
I keep getting this error:
Fatal error: Allowed memory size of 67108864 bytes exhausted
Even though I've edited php.ini to this:
max_execution_time = 300 ; Maximum execution time of each script, in seconds
max_input_time = 600 ; Maximum amount of time each script may spend parsing request data
memory_limit = 96M ; Maximum amount of memory a script may consume (16MB)
Where would the 67108864 bytes limit be coming from?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了类似的问题。这可能是因为您在某个变量中存储了非常大的数据,或者从 mySQL 表中选择了大量数据。您需要提供有关脚本的更多信息,因为 64M 确实足以执行大部分处理。
I faced a similar issue. It might be because you're storing something very huge in some variable or selecting a lot of data from your mySQL table. You need to provide more information about your script because 64M is really sufficient to execute most of the processing.
通过阅读评论,很明显您正在使用共享托管帐户。
这些通常不允许您编辑自己的
php.ini
,也不允许对您的喜好进行任意限制。这将很快关闭共享托管服务器。By reading the comments, it's obvious you're on a shared hosting account.
Those usually don't let you edit your own
php.ini
, nor allow arbitrary limits to your pleasing. This would quickly take down the shared hosting server.首先,据我所知,它必须是96M(不含B)
其次,确保您正在编辑正确的 php.ini,并且在更改后重新启动 Web 服务器(例如,如果 PHP 作为 apache 模块加载,则需要)。
第三,增加内存限制可能会解决问题,但最好检查一下为什么 64M 不够:)
First, as far as I know, it has to be 96M (without the B)
Second, make sure you are editing the correct php.ini, and you are restarting the web server after the change (needed if PHP is loaded as an apache module for example).
And third, increasing the memory limit may resolve the problem, but it's best to check why 64M are not enough :)
你重启apache了吗?有时这是必要的。
Did you restart apache? Sometimes it's necessary.