How to increase maximum upload file size in Prestashop
Let's talk we have a new Prestashop module called DocumenThemix. This is one of our latest Prestashop modules helps you create professional, personalised Prestashop documents such as Invoices, Credit Slips or Delivery Slips in PDF that fit your brand, in seconds. It's a great module, and its file size is 7MB.
Sometime, the php configuration puts limits on upload file size. The default settings will restrict this to a max 2 MB upload file size. You need to increase this value to upload your favourite modules & themes (do you know how to install Prestashop Themes?).
First, we need to know about upload_max_filesize and 2 other values.
- Upload_max_filesize - The maximum length of an uploaded record.
- Memory_limit - This unit is the maximum quantity of memory in bytes that a script is permitted to allocate. This helps prevent poorly written scripts for eating up all to be had memory on a server. Note that to have no memory restriction, set this directive to -1.
- Post_max_size - Sets max size of post records allowed. In case you want to upload large files such as the premium Prestashop themes or Documenthemix module, this value should be large than upload_max_filesize. If reminiscence restriction is enabled by your configure script, memory_limit additionally affects document uploading.
Generally speaking, memory_limit need to be large than post_max_size.
I suggest two methods for fixing this problem.
Edit the php.ini
Open php.ini file at /etc/php/apache2/php.ini or your-root-website/php.ini, search for the following variables and change these to:
memory_limit = 50M
upload_max_filesize = 10M
post_max_size = 10M
Some extra values to edit if you want a higher overall performance of your website on the server:
max_execution_time = 300
max_input_time = 600
memory_limit = 720M
Save the file and restart the Apache web server!
If the first way does not work, or you don't have get right of entry to to the servers file system. For example: your web page is hosted on a commercial web server, then edit the .htaccess file in your website's root.
Add these source codes into your .htaccess
php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M
Save your file and enjoy your time.