search
Homephp教程php手册php Allowed memory size of 8388608 bytes exhausted (tried to

今天在用一个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....了,。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.