{"id":8555,"date":"2020-04-30T14:28:27","date_gmt":"2020-04-30T18:28:27","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=8555"},"modified":"2022-08-28T15:06:01","modified_gmt":"2022-08-28T19:06:01","slug":"increase-php-memory-limit","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/increase-php-memory-limit\/","title":{"rendered":"Three Ways to Increase the PHP Memory Limit"},"content":{"rendered":"\n
Here is how to increase the PHP memory limit and avoid crashing your web applications using anyone of the three convenient ways.<\/p>\n\n\n\n
Generally, PHP<\/a> scripts are only allowed to use a certain amount of memory per request. This is for good reason. It prevents rogue or badly written scripts from gobbling up all the available memory on a server and wreaking havoc on other services and applications running on the same server.<\/p>\n\n\n\n There are times when a script may require more memory than that which has been allocated by the server admin. This is easy to detect as the webserver error logs should print out a line similar to this:<\/p>\n\n\n\n Where x is the amount in bytes your PHP tried to allocate.<\/p>\n\n\n\n To fix this issue you need to increase the PHP memory limit. There are three main ways to do it.<\/p>\n\n\n\n This method will affect all scripts running in the affected system. You will need to open the file with your favorite text editor and find the line that looks similar to this:<\/p>\n\n\n\n The location of the PHP Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x) in yourscript.php<\/code><\/pre>\n\n\n\n
Increase PHP Memory Limit via php.ini file<\/h2>\n\n\n\n
memory_limit = 16M<\/code><\/pre>\n\n\n\n
php.ini<\/code> file really depends on the Operating System<\/a> and in some cases the version number.<\/p>\n\n\n\n