ONLINE SUPPORT
Online Support Web Hosting

How to Increase PHP Memory Limit

PHP installation comes with default settings and this is already good for some websites and website administrators. But some website needs more than the default amount of memory. If that’s the case, you can configure the PHP memory limit to cater to the need of your website. Sometimes you may see an error like this:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2515174 bytes)
in (file path) on line (0).

This example shows that the memory limit (32MB) has been reached and when an additional 2.4MB is requested to be allocated, PHP fails with a fatal error. You can fix this particular error by increasing the memory limit in your php.ini file.

If you don’t have a php.ini file yet and want to know how to create one, click the link below:

By default, your site will use the standard PHP settings on your server. However, if you need to revise or change any of the default PHP settings on your server, you can do so by creating and/or modifying a php.ini file.

Continue reading this article to learn how to increase the PHP memory limit via your File Manager.

How to increase the PHP memory limit

As mentioned, you can fix a PHP: Fatal Error by increasing the PHP memory limit in your php.ini file. To do this, follow the steps below.

  1. Access your File Manager.
  2. Scroll to public_html folder and locate your php.ini file.
  3. Right-click on the php.ini file and click Code Edit. A pop-up window will appear, click Edit to continue to the editor page.
  4. Using the Code Editor, within the php.ini file, search for the following text:
        max_execution_time = 30
        max_input_time = 60
        memory_limit = 128M
    Increase the size of the memory_limit. The size is usually in megabytes.

    Important: To make sure that your server runs efficiently, do NOT set a PHP memory limit value that is more than 60% of the size of your server's RAM.
    Moreover, it is NOT recommended that you set the memory limit to -1 (unlimited) because it will cause your "page load time" to lag.

  5. Click Save Changes.
  6. Reload/refresh your site and test if the increase in memory_limit is enough.
    If it isn’t, it is recommended that you increase the memory_limit value again until you find the size that will resolve the memory-related Fatal Error.

    Important: In order for your php.ini updates to take effect in all your child folders, you have to make php.ini recursive.

To learn how to make php.ini recursive, click the following guide:

Please let us know if you need any further assistance, or if you have any questions. We’d love to help!

Was this helpful? Yes No 28% of people found this helpful.
Need Help?
Talk to one of our dedicated agents now