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

Getting an error message as Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 4864 bytes)
SuhashkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cr4ck3rj4ckCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MMDeveloperCommented:
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.


ini_set("memory_limit","250M");

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.