When working with php programs on your hosting server, you will inevitably run into errors. One of the more common errors is the "Allowed memory size" error. This error simply means that the program needs to have more memory allotted to it. Below is an example of the error:
Fatal error: Allowed memory size of 32673223 bytes exhausted (tried to allocate 280559520) in Unknown on line 0
To fix the error, we will need to increase the allowe memory in your php.ini file. This is found in your hosting account folders. Below are the instructions to guide you on how to fix the php memory error in your php.ini file.
Fixing the "Allowed memory size" error
- First, log into your cPanel dashboard.
- Now that you are in the main cPanel area, find and enter the web root using the File Manager.
- Locate the php.ini file in your public_html folder. If you do not have one, our Live Support team can place a default one in your account, or you can create a blank file by clicking on the New File icon and naming it php.ini so you can edit and add your own settings. Once you have a php.ini file, open it for editing.
- Inside the php.ini code editor, look for the line below:
memory_limit = 128M
Once you find the code line, you can increase the memory limit. It is customary to double the amount that is currently in the setting. (32M to 64M, 128M to 256M, etc) You can always increase it more if you need to.
- Once the change has been made, click the Save Changes button. This will enable your new memory allotment setting.
- Finally, to ensure the setting is activated for all files and folders on your account, make sure the php.ini file is recursive.
If you have set the memory limit as high as 512M and are still getting the error, it is possible the program you are using has some sort of override for this setting. In that case, please contact our Live Support team and they will be happy to look into the issue further.