PHP 内存限制 - 无需编辑 php.ini 即可更改? [英] PHP Memory Limit - change without editing php.ini?

查看:38
本文介绍了PHP 内存限制 - 无需编辑 php.ini 即可更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Symfony2,并且在我付费的托管服务器上,我可以看到耗尽内存的错误.是否可以在不编辑 php.ini(无法访问)的情况下设置新限制?

I'm using Symfony2 and on the server from the hosting I pay for I can see the error of exhausting memory. Is it possible to set new limit without editing php.ini (which is not accessible)?

推荐答案

您可以在 PHP 脚本中使用 ini_set() 函数.

You can set it in PHP script with ini_set() function.

memory-limit 指令是 PHP_INI_ALL 可变的,这意味着它可以随处更改.

memory-limit directive is PHP_INI_ALL changeable, which means that it can be changed everywhere.

ini_set('memory_limit','256M');

这篇关于PHP 内存限制 - 无需编辑 php.ini 即可更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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