Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 529661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:06:54+00:00 2026-05-13T09:06:54+00:00

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 40000 bytes)

  • 0

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 40000 bytes) in /mounted-storage/home20a/sub001/sc20063-GJYD/[…] on line 62

It looks like the PHP-script only allowes me to allocate 32 MB to the memory? This was with an example image to test what would happen if a user tries to upload a huge picture.

My question is: How can i predict that this will happen, and then alert the user that the image was too big instead of returning this error? Its a while since I tested it, but I think I tried both try-catch and @, but they both failed since this is a fatal error. The size of the example image is only 1 kB, so it won’t work checking that value.


I think I solved my own problem, I can check the $width and $height of the image, and then notify the user if the image is too big, but I have another question: How do I change the allowed amout of allocated memory? I assume that my users will try to post many high-resolutioned images. I have tried ini_set("memory_limit", $bignumber), but it isn’t working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:06:55+00:00Added an answer on May 13, 2026 at 9:06 am

    To change the memory_limit, you have to edit the memory_limit directive in your php.ini file — it can be done in your Apache’s VirtualHost, too, if you don’t want the modification to be effective for your whole server, but only for one website.

    But you might not always do that — you need to be administrator of your server…

    BTW, you can take a look at How to change configuration settings.

    Another possibility might be to use imagemagick, and its convert executable, using one of the Program execution Functions. This way, the resizing of your image wouldn’t be done by PHP.

    But, here, it means you depend on an external program…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Fatal error: Allowed memory size of 31457280 bytes exhausted (tried to allocate 9828 bytes).
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 13965430 bytes)
I am having really weird problem: Fatal error: Allowed memory size of 134217728 bytes
I get the following compilation error fatal error C1189: #error : ERROR: Use of
Error message: fatal: git checkout: updating paths is incompatible with switching branches/forcing How to
I am getting the error OperationalError: FATAL: sorry, too many clients already when using
The log levels WARN, ERROR and FATAL are pretty clear. But when is something
I've got this weird error when i try to generate either the filters or
I am trying batch resize a bunch of images (~220). I am getting: (everytime)
I want to log the stack trace from time to time in my application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.