'How do I set the maximum php memory limit

How should I set 10GB of memory_limit?

Should I display it as

memory_limit=10G

or

memory_limit=10240M



Solution 1:[1]

For only current file you can write these script into your code.

ini_set('memory_limit','10240M');

but if you want to do it permanently then.

 1) open your php.ini file
 2) change memory_limit = 10240M

Solution 2:[2]

You can have memory_limit=-1 to allocate unlimited memory. (The maximum your RAM can offer)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Passionate Coder
Solution 2 Dula