On unusual occasion, I need to increase the memory limit for PHP. Usually it’s when I am working with large files or sql commands that can take a while to run. There’s an easy way to raise the amount of memory permitted to PHP right in your script (if your hosting allows it!):
ini_set(‘ memory_limit’,’ 32M’);.
The above code will boost the optimum quantity of memory offered to PHP to 32 MB. Once again, the setup is only changed for the running script.