Getting Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 4864 bytes)

Posted on 2008-11-10
Medium Priority
Last Modified: 2012-05-05
Getting an error message as Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 4864 bytes)
Question by:Suhashk

Accepted Solution

cr4ck3rj4ck earned 1000 total points
ID: 22922135
This is due to the php.ini file. It's the maximum limit set by your PHP configuration.

Try adding the following line to your script:
ini_set('memory_limit', -1);

If that doesn't work, you'll need to change the php.ini which could be tricky if you're on shared hosting.
LVL 15

Assisted Solution

MMDeveloper earned 1000 total points
ID: 22922137
in your php script, you may temporarily need to set the memory limit via code, such as at the top of your php file, use this code below... However I'd highly recommend finding what part(s) of your code consumes all the memory and explore ways to fix it.


Open in new window


Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question