Need help? Chat now!

Hostwinds Tutorials

Search results for:

Table of Contents

What Causes PHP Memory Errors?
How Do I Fix PHP Memory Errors?

PHP Memory Errors

What Causes PHP Memory Errors?
How Do I Fix PHP Memory Errors?

This guide is intended for Hostwinds clients who have access to WHM on their VPS, Cloud, or Dedicated Server.

What Causes PHP Memory Errors?

Allowed memory size errors commonly occur with sites built with open source CMS systems like WordPress, Joomla, Drupal, and Moodle. PHP isn't allowing enough memory to run or load what's being requested.

How Do I Fix PHP Memory Errors?

The easiest and quickest way to fix this is to increase the amount of memory that PHP allows. However, if you're on our shared hosting, you'd need to upgrade your hosting plan to be able to do this (See the second note at the bottom for a possible solution).

Step 1: Log in to WHM for the new server you're moving to  (details to log into your WHM are provided in a welcome email upon purchase)

Step 2: Go to the PHP configuration editor.

Step 3: Edit the "memory_limit" variable

Step 4: Save changes

While this may help for a while, the errors are likely to return. If you're getting this error, there's an excellent chance that your code needs to be trimmed and optimized.

For shared hosting services and Hostwinds clients using WordPress: The wp-config file may be limiting the amount of memory available, as it may be allocating less than what PHP is allocating. You can try to increase the amount of memory WordPress is allowing in this file, but the amount in the php.ini file will determine the maximum amount allowed.

_Example_**:** If PHP is only allowing 128MB and you tell the wp-config file to allow 512MB, you're still only going to get 128MB. But PHP might be allowing more than what the wp-config file is allowing, so increasing the amount there would help if that's the case. This can be increased by upgrading your account to a VPS or Dedicated Server to have full control of this setting.

Written by Hostwinds Team  /  December 13, 2016