Like almost everything that runs on computers, PHP scripts require memory (RAM) to operate. Not having access to sufficient memory can cause some scripts to fail, resulting in error messages instead of working web pages.
If you encounter errors such as “Fatal error: Allowed memory size of X bytes exhausted” then you may need to increase your PHP memory limits.
Increasing PHP Memory Limits via SPanel
- Step 1. Log in to your SPanel dashboard.
- Step 2. Click on “PHP INI Editor” under the “Tools” section.
- Step 3. Select the domain you wish to adjust memory limits for.
- Step 4. Under “memory_limit” change the existing field to the new amount required. The figure should follow a Megabyte increment. For example, to set it to one gigabyte, use 1024M.
Understanding PHP Memory Limits
The PHP memory limit is not an overall usage figure. It refers to the amount of memory usable for each visitor session. To illustrate this, let’s take the example of a 128MB PHP memory limit. In this scenario, ten visitors concurrently on your site may result in memory usage of up to 1,280MB.
Setting excessive limits for PHP memory may result in overly high resource consumption, which will ultimately be limited by the amount of memory allocated to your hosting plan.