ini_set('memory_limit','128M');
It says everywhere that memory is set to 128M, but still get that error?
The error is in Swift library (library for sending emails), in abstractSmtpTransport.php, so it's not my code int's suposed to work.
Any ideas???
Edit: Yes, the previous was done restarting apache.
EDIT 2:
@patrick, added that but nothing was echoed
Tryed with lower value, 28M int every file, restarted apache, same error (phpinfo showed new value)
tried with -1, restarting, and same error.
EDIT 3: isn't it weird that allowed memory is bigger than allocated memory? (despite the fact that allowed memory size is way below real allowed memory asigned)
–
–
I see my problem is a little bit different from yours, but I'll post this answer in case it helps someone else. I was using MB
as shorthand instead of M
when defining my memory_limit, and php was silently ignoring it. I changed it to an integer (in bytes) and the problem was solved.
My php.ini changed as follows: memory_limit = 512MB
to memory_limit = 536870912
. This fixed my problem. Hope it helps with someone else's! You can read up on php's shorthand here.
As Yaodong points out, you can just as easily use the correct shorthand, "M", instead of using byte values. I changed mine to byte values for debugging purposes and then didn't bother to change it back.
–
–
–
–
The value of 262,144 bytes is the key to the diagnosis. You'll see this magic number pop up in PHP questions all over the place. Why? Because that is the value PHP will end up with as its memory limit if you attempt to update the limit with a value it can't use. An empty string will produce this memory limit, as will an incorrect unit notation like '128MB' instead of the correct '128M'.
262,144 bytes is exactly 256 Kibibytes. Why PHP runs home to that value when it gets confused is beyond me.
isn't it weird that allowed memory is bigger than allocated memory?
The allocated amount shown is just the most recent allocation attempt, the one that ran afoul of the memory limit. See Allowed memory size in PHP when allocating less.
–
See if this answer can help you. Particularly the fact that CLI ini could be different than when the script is running through a browser.
Allowed memory size of X bytes exhausted
–
In my case neither M
or G
helped, so I have converted allocated memory to bytes using: https://www.gbmb.org/mb-to-bytes
4096M = 4294967296
php.ini:
memory_limit = 4294967296
I was trying to up the limit Wordpress sets on media uploads. I followed advice from some blog I’m not going to mention to raise the limit from 64MB to 2GB.
I did the following:
Created a (php.ini) file in WP ADMIN with the following integers:
upload_max_filesize = 2000MB
post_max_size = 2100MV
memory_limit = 2300MB
I immediately received this error when trying to log into my Wordpress dashboard to check if it worked:
“Allowed memory size of 262144 bytes exhausted (tried to allocate 24576 bytes)"
The above information in this chain helped me tremendously.
(Stack usually does BTW)
I modified the PHP.ini file to the following:
upload_max_filesize = 2000M
post_max_size = 2100M
memory_limit = 536870912M
The major difference was only use M, not MB, and set that memory limit high.
As soon as I saved the changed the PHP.ini file, I saved it, went to login again and the login screen reappeared.
I went in and checked media uploads, ands bang:
Image showing twordpress media folder “Add New” box, with limits stated as “MAXIMUM UPLOAD FILE SIZE: 2 GB”
I haven't restarted Apache yet… but all looks good.
Thanks everyone.
–
Had a similar issue and modifying my wp-config.php
file did not help. Mine was a multisite and the steps I took to solve it are below. So check to see if your site is a multisite and this might help.
Log into your cPanel and check the software section. Click on the "MultiplePHP INI Editor" icon. On the "configure PHP INI asic settings" page, select the Home Directory or specific domain from the dropdown and edit.
These are the changes I made to mine:
memory_limit = 256M
upload_max_filesize = 12M
post_max_size = 13M
file_uploads = On
max_execution_time = 180
Save your changes, clear your browser's cache before checking to see is the error is gone.
In my case it was because I had another folder that contained xampp and all it's files (htdocs, php e.t.c). Like I installed Xampp twice in different directories and for some reason the configurations of the other one was affecting my current xampp directory and so I had to change the memory size in the php.ini file of the other directory too.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.