PHP头条
热点:

php Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in....


今天在用一个php产品时出现了Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in....提示信息,经过查核是因为此产品未考虑到用户内存引起的,下面我们来看看如何解决此方法

php.ini这个参数memory_limit引起的,因为对它的设置不够在所以引起了上在的问题,下面我们来看看几种解决方法


方法一,用程序来实现

  在你的php代码中增加以下命令行即可 

 代码如下 复制代码
ini_set('memory_limit','128M');

这种需要你的服务器未禁止修改,一般的虚拟空间是不可以操作的。

方法二,利用.htaccess 来做,这种可行性超高。

  在你的.htaccess里加入

 代码如下 复制代码
php_value memory_limit 128M ;

可以将128M改为任何你想设置的值 就可以了。

方法三,这要针对有服务器管理权限的朋友了,直接修改php.ini文件了。

   找到“memory_limit”这一项,如果没有,你可以在文件的尾部自己增加这个参数。以下是一些设置范例

 代码如下 复制代码
memory_limit = 128M ;

可以将128M改为任何你想设置的值
   重启apache就可以了。

这样我再运行那产品不没会出现前面讲到的Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in....了,。

www.phpzy.comtrue/php/27176.htmlTechArticlephp Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in.... 今天在用一个php产品时出现了Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in....提示信息,经过查核是...

相关文章

    暂无相关文章

PHP之友评论

今天推荐