When you upload a theme/module/post with a big file size, you may face an error (The file is too large. The Allowed maximum size is 2MB), so you have to increase the memory limit of Prestashop. Due to max_execution time, you also may face the error. This kind of error is very common you may face. Even if you are trying to install a large file size addon, you will see the same error. If you don’t have the available memory on your server then you may face a memory_limit error.
From the PHP.nets documentation:
This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server.
PHP memory limit is the maximum amount of server memory that the single PHP script is allowed to consume. When it blocks then the error show like this:
Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x bytes) in /path/to/php/script
PHP Fatal error: Out of memory (allocated x) (tried to allocate x bytes) in /path/to/php/script
To solve this error, you have to set the maximum file size. It is very easy to solve the issue. If your Prestashop version is > 1.7, then you can change the file size in 2 ways.
- From the hosting where you have installed the Prestashop.
- From the back office.
How to increase the memory limit of Prestashop
From the hosting where you have installed the Prestashop
You can change the max_file/memory_limit/post_max_size from the hosting easily.
- Log in to your hosting, where you have installed Prestashop.
- Search “MultiPHP INI Editor” and click on that.
- Click “Select a location.”
- From the dropdown, select your domain name.
Now you will see the options like: max_input_time, max_input_vars, memory_limit, post_max_size, upload_max_filesize.
You can increase the memory limit of Prestashop size or limit from here. For example, if you want to increase the upload_max_file size, go to that section and increase the number 100M from your requirement.
From the back office
You can increase the memory limit of Prestashop to only the upload quota limit from the back office. To increase the execution time then you have to follow the first step. To change the upload quota, follow those steps:
Log in to the back office.
Go to the CONFIGURE > Advanced Parameters > Administration > Upload quota.
This way you can increase the memory limit of Prestashop.