Welcome to the Hindi Tutor QA. Create an account or login for asking a question and writing an answer.
Pavan in Web Designing
edited
How to Fix the uploaded file exceeds the upload_max_filesize directive in php.ini . The Uploaded file exceeds the upload_max_filesize directive in php.ini error in WordPress, occurs when uploading large files, themes.

2 Answers

+1 vote
Pooja
edited

Increase the limits in php.ini

You can increase the allowed upload size of phpmyadmin by editing your server's php.ini configuration file.

With apache2 and php7.4 installed you need to make three changes in the php.ini file. First open the file for editing, e.g.:

sudo nano /etc/php/7.4/apache2/php.ini

Next, search (Ctrl + W) for the post_max_size entry, and enter a larger number than the size of your database, for example:

post_max_size = 1024M

Next edit the entry for memory_limit and give it a larger value than the one given to post_max_size.

memory_limit = 1024M

Fix the uploaded file exceeds the upload_max_filesize directive in php.ini 

Then ensure the value of upload_max_filesize is smaller than post_max_size.

upload_max_filesize =  1024M

The order from biggest to smallest should be:

    memory_limit = 300M
    post_max_size = 200M
    upload_max_filesize = 100M

Please Note : post_max_size should be larger than upload_max_size.

Restart Apache Services for changes to be applied.

sudo systemctl restart apache2
+1 vote
Apurva Singh
edited

Increase Maximum PHP Execution Time

Find the file called: php.ini on your server and follow below steps

With apache2 and php7.4 installed you need to make three changes in the php.ini file. First open the file for editing, e.g.:

For PHP v7.3

sudo nano /etc/php/7.3/apache2/php.ini

For PHP v7.4

sudo nano /etc/php/7.4/apache2/php.ini

Next, search (Ctrl + W) in this file for the max_execution_time entry, by defaul it has 30 second, for example:

max_execution_time=30

You can increase value as your requirement. 

Now Restart Apache Services for changes to be applied.

sudo systemctl restart apache2

For PHP-FPM

If you enabled PHP-FPM, then type this command line for open and edit php.ini

sudo nano /etc/php/7.4/fpm/php.ini

Edit, as your requirement:

memory_limit = 300M
post_max_size = 200M
upload_max_filesize = 100M
max_execution_time=300

Restart Apache And PHP-FPM Services for changes to be applied.

sudo systemctl restart apache2
sudo service php7.4-fpm restart

Related questions

...