“Allowed memory size of bytes exhausted” usually means a PHP script exceeded its permitted memory limit. It can occur in applications such as WordPress. Investigate the cause, then adjust settings within the resources available on your hosting account.

Understand the error

The message commonly looks like this:

PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes)

The script tried to use more memory than PHP permits. You can investigate and fix excessive memory use or increase the limit where the hosting configuration allows it.

Step-by-step solutions

1. Increase the PHP memory limit through cPanel MultiPHP INI Editor

In cPanel, use MultiPHP INI Editor to review and change the PHP memory limit:

  1. Sign in to your cPanel account.

  2. Open Software > MultiPHP INI Editor.

  3. Select the domain from the dropdown.

  4. In the Basic Modetab, find memory_limit.

  5. Increase the value if appropriate, for example to 256M or 512M within your permitted resources.

  6. Click Apply to save the changes.

For detailed instructions, see this guide. Note: The change affects scripts to which the selected configuration applies; its scope depends on the file and environment being edited.

2. Edit wp-config.php (for WordPress users)

For WordPress, you can request a higher memory limit in wp-config.php, subject to the PHP and server limits:

  • Access site files through cPanel File Manager or an FTP client.

cPanel File Manager
  • In the site’s root directory (often public_html)

public_html root directory in File Manager
  • Find wp-config.php

WordPress wp-config.php configuration file
  • Edit the file and add the following above /* That's all, stop editing! Happy blogging. */. If the constant already exists, edit it instead of adding a duplicate.

define('WP_MEMORY_LIMIT', '256M');

  • Save the changes and check whether the error persists.

Note: This setting applies to WordPress and does not change other PHP applications or override enforced hosting limits.

3. Edit .htaccess

Use php_value in .htaccess only if your PHP handler supports it; it can cause HTTP 500 with other handlers. Prefer the PHP configuration tool recommended by your host:

  • Locate .htaccess in the site’s root directory, often public_html.

If .htaccess is not visible, see this guide to learn how to show hidden files.

  • If supported, edit the file and add:

php_value memory_limit 256M

  • Save and test the site; revert the change if it causes an error.

4. Edit php.ini

If your hosting configuration permits editing php.ini:

  • Identify the PHP configuration file actually used by your application through cPanel or your hosting provider.

  • Find the memory_limit directive.

  • Increase its value where appropriate, for example:

memory_limit = 256M

  • Save and test the site.

Note: The effect of php.ini depends on which configuration is loaded. Editing a local file does not necessarily affect every PHP application on the server.

5. Disable plugins (for WordPress users)

A faulty or resource-intensive plugin can cause excessive memory use:

  1. Access site files through cPanel or a suitable file-transfer client.

  2. Open wp-content and temporarily rename plugins to plugins-deactivated.

  3. Check whether the site loads without the error.

  4. If it does, restore the directory name to plugins and reactivate plugins individually through WordPress administration to identify the problem.

Note: Always keep backups before disabling plugins.

6. Optimize code and resources

If a higher memory limit does not solve the problem, consider optimizing the site:

  • Reduce plugins: Disable and remove unnecessary plugins.

  • Optimize themes: Use maintained themes without unnecessary resource-heavy features.

  • Use caching: Appropriate caching can reduce repeated work and server load.

  • Optimize databases: Review and maintain database tables after making a backup.

Note: Efficient application code can substantially reduce memory use.

Conclusion

PHP memory exhaustion can often be resolved by fixing excessive resource use or increasing the limit within the hosting account’s capabilities. Keep recent backups before changing the configuration. If the problem persists, contact our support for further assistance.


Share

Reference documentation:

Sources accessed on October 11, 2026. Available features depend on your hosting version and options.