Overview
The following explains how to increase the PHP memory limit of a website.
Background
Every installation of PHP is configured with a default memory limit. This works well for most websites, however, if your website requires more memory, you may receive the following error indicating that the memory limit has been reached:
Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 5072 bytes)
You can then increase it by editing your user's php.ini (phprc).
Different types of memory
There are different types of memory you should be aware of before updating your PHP memory limit. For example:
- Server Memory (RAM) — This is the amount of memory the physical server uses. On a shared server, this value is shared between all customers. On a VPS or Dedicated server, this value is isolated to that specific machine.
- User PHP memory — The amount of PHP memory a user has for all its websites. If a user has three websites, all combined would use this value.
- WordPress PHP memory — The amount of memory available for WordPress to use. This is related to PHP memory but is configured within the website's wp-config.php file.
Make sure you are adjusting the correct values to ensure your issue is resolved.
Before you make changes
Make sure you observe the following before making any changes to your PHP settings:
- The memory_limit setting directly caps how much RAM a single PHP process can use.
- On Shared hosting or lower-resource VPS plans, setting a higher value such as 512M can quickly exhaust available memory if multiple PHP processes run at once.
- Increasing this value affects all sites under the same SFTP/SSH user.
- If the value exceeds your plan’s available resources, it may revert to the default (128M for shared and 256M for VPS/Dedicated/DreamPress).
- If your site consistently requires higher limits, consider upgrading your hosting plan.
How to increase the PHP memory limit
The following sections explain how to manage the PHP memory limit for your site.
Increasing the PHP memory limit from the panel
To increase the PHP memory limit directly from your panel:
- Navigate to the Manage Websites page.
- Click the Manage button to open Website settings, which allows you to modify various configurations for your site.
- Click the Settings tab.
-
In the Website Settings section, click Manage next to PHP.
The PHP Settings page opens. - Scroll down to the PHP settings section.
- On the General row, click the Modify button.
- Locate the memory_limit setting and select a desired value from the dropdown menu.
-
Click the Save Changes button when finished.
No manual restart or process killing is required when using the panel.
Increasing the PHP memory limit from a phprc file
To increase the PHP limits on DreamPress sites, use the .user.ini file instead.
You must create/edit your user's phprc file to increase this limit. See the following articles for instructions on how to create a phprc file:
If the file already exists, view the following articles for instructions on how to update it:
Add the following line to increase it to 300MB:
memory_limit = 300M
If you find you're increasing the memory a large amount, it's time to consider moving off of Shared Hosting, as your website has greater needs than this plan can reliably provide.
Increasing the WordPress PHP memory limit
If you're running a WordPress site, the setting in your phprc file may not take effect since WordPress is overriding it in your wp-config.php file. To fix this, just update your wp-config.php file with the specific memory limit. For example:
- Log in to your WordPress site via FTP or SSH.
- Make sure you're in your site's directory. You'll see your wp-config.php file here.
-
Edit this file (using FTP or SSH) to add the following lines. Make sure to add these before the wp-settings.php inclusion. For example:
define( 'WP_MEMORY_LIMIT', '300M' ); define( 'WP_MAX_MEMORY_LIMIT', '300M' ); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php');
See this article for further information.
Killing off all running php processes
Make sure to kill running php processes to ensure your new settings take effect.
Confirming your changes
After you've edited the file and killed off all PHP processes, you should check to confirm the values have updated. You can do this by creating a phpinfo.php file. If you do not see your changes have updated, try killing off your PHP processes again.