Ever go to update WordPress and received this error?
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2516357 bytes) in /home/edm/public_html/wp-includes/http.php on line 1363
That’s because the php.ini is setup to only allocate so much memory to script execution. In this case, my .ini file was set to only allocate 32MB; hence 33554432… 33554432 byte = 32 megabytes. We only need another ~2.5MB to run the script (according to the error) but I think it’s better to be safe than sorry and aim high so you don’t have to dick with it again. You can change this at runtime, or in the php.ini file. Here’s how to do both…
Change at runtime:
- Go to the file listed in the error message (in this case, http.php)
- At the top of the file inside the opening PHP tag (say, line 2) paste the following snippet
- ini_set(“memory_limit”, “64MB”);
- substitute 64 for whatever you want, within reason
- Save the file and re-run the updater/script
Change in php.ini (my preferred method)
- Locate the php.ini file
- if you don’t know where it is, or don’t have access to it contact your host
- Inside the file, do a find on “memory_limit”
- mine was line 232, default value of 32MB…
- Replace the old value [32MB] with your value of choice… I chose 128
- you can go as high as you want…
- IMHO, not more than 128MB should be needed for a WP… you’d have to have some thing rendering images/pdf’s or something to need more
- Save the file and re-run the updater/script
If you change this in the .ini file, you *shouldn’t* run into this when you update next time. If you’re using the runtime method, you’ll probably need to make this change each time you update. Basically, if you have the option, just bump it up in the .ini file. It will save you a grumble and 30 seconds the next time you go to update WordPress. If you don’t have the option of updating the .ini file, you’re stuck with changing it at runtime. If you get sick of editing http.php every update, talk to your host about updating/locating the .ini file.
As always, comments and questions are welcome!
Popularity: 1%
