
How to Check PHP memory limit of my Website?
Some times you face an issue of PHP Memory limit exhausted and your website stops working. what is PHP memory limit?
How it affects my website while developing or accessing it.
PHP Memory Limit sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps to prevent poorly written scripts for using all available memory on a server.
how can you check your current value of php memory limit?, it’s simple as 1 2 3
you need to add a php file with following code:
<? phpinfo(); ?>
Once you created the file, access it and search for “memory_limit”
The default value is 32MB or 64MB or 128MB or as per set by your Web Hosting Provider. you can increase it as per your web application, you need to find how much it requires.
You may have seen the PHP script exceeds the allotted limit by Web Hosting Provider, you will see an error something like:
Fatal error: Allowed memory size of xxxxx bytes exhausted (tried to allocate xxxx bytes) in /home/username/phpsite/myscript
or
PHP Fatal error: Out of memory (allocated xxxxxx) (tried to allocate xxxxx bytes) in /home/username/phpsite/myscript
You can increase your server’s memory_limit by editing the php.ini file which exists at your server’s root.
you will find the same the line starting with memory_limit:
memory_limit = 128M

for Cloud Backup
Leave a Comment