PHP - memory limit
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
With default 128MB, everything is ok
But when i edit php.ini like this
memory_limit = 1280000开发者_开发问答00 ; Maximum amount of memory a script may consume (128MB)
I got i notice :
Fatal error: Allowed memory size of 262144
128000000 @ 128MB or apache don't know 128000000
We don't know how the php ini parser is handling your request when you are not using their standard way of writing memory size using a letter at the end.
One thing is certain though even though it doesn't add up to 262144, 128 000 000 will never be 128MB but more like 122MB because as I'm sure you know 1MB = 1024 * 1024 bytes !!
If you really need what you are doing, you may want to try : 128000000b (note the 'b' at the end of the number) but i'm not sure php ini parser developer ever thought someone would throw bytes at them.
The right way is by using unit (128M
)
The default behavior if given an integer is to interpret it as bytes. See http://php.net/manual/en/ini.core.php. And as Yahel pointed out 1MB = 1024 bytes. So if you want 128MB you either write in "128M" or "134217728"
Also remember that you can always check what your memory limit is set to with phpinfo();
If your php wasn't compiled with --enable-memory-limit in the configure line (if you are using a version earlier than 5.2.1) then none of this will work.
You should write as below.
it should be multiple of 8 memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
It by default takes memory in MB.
精彩评论