php Allowed memory size of 8388608 bytes exhausted (tried to_PHP教程

WBOY
Libérer: 2016-07-13 10:55:38
original
1245 Les gens l'ont consulté

今天在用一个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.bkjia.comtruehttp://www.bkjia.com/PHPjc/632229.htmlTechArticle今天在用一个php产品时出现了Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in....提示信息,经过查核是因为此产品未考虑到用...
Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!