PHP Fatal error: Allowed memory size of 268435456 bytes exhausted. - How I can add 512 MB of memory?
Thank you
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
As long as the server or Droplet has additional RAM, you can increase the limit for PHP by modifying your php.ini file and changing memory_limit.
Increasing that limit to 512M may be overkill though and it’s something I’d be careful in doing. If you are seeing a script take that much RAM, I’d see what’s going on and see if it’s possible to optimize it, thus reducing the amount of RAM it can consume at once.
Even for WordPress (as an example), setting memory_limit to 512M would be overkill.
First your server needs to have more memory available. So you can config this on php.ini, in the parameter memory_limit, but these type of error you need to verify if just more memory will solve the problem, or your rotine will consume all and will throw this error again.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.