PHP memory limit Print

  • 2

Introduction: Encountering a PHP memory limit error can be frustrating. In this article, we will guide you on how to increase the memory limit for your scripts on your hosting account.

Error Example:

If you come across an error like this:

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

This indicates that the PHP script you are running is trying to use more memory than what is currently allowed by the server's PHP configuration.


While you can set the PHP variable "memory_limit" specifically for your account, our servers will remain at their default value. To increase the memory limit for your script, you need to create or edit a ".htaccess" file in your script's directory. Follow these steps:

1. Access your hosting account's file manager or connect via FTP.
2. Navigate to the directory where your script is located.
3. Look for the ".htaccess" file. If it doesn't exist, create a new one.
4. Open the ".htaccess" file and add the following line:

php_value memory_limit xM

Replace `x` with the desired memory limit value in megabytes (e.g., 128M for 128 megabytes). Please ensure that you set a reasonable value for the memory limit, as setting it too high may cause performance issues on the server.

5. Save the changes to the ".htaccess" file and close it.

After following these steps, the PHP memory limit for your script should now be increased to the specified value. If you continue to experience issues or need further assistance, please contact our support team.

Was this answer helpful?
« Back