How to increase the max_file_size for PHP?

Hi,

I try to upload a plugin to my Wordpress and I have this message:

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

So, I checked the PHP File in the Others > PHP Configuration, and have changed the setting for 10MB. I restarted Webmin, and also Apache in SSH but still have the same error message. I also cleared my browser cache.

Any suggestions ? -_-

Thanks!

Try to restart php (if you change something in php, then you need to restart php and not other servivces) first. If that doesnt work, try this:
The easiest way to go would be to upload a php file with this content:

<?php
phpinfo();
?>

Make sure to remove the file after you are done.
Every php value which is set and takes effect will be listed there. The most important part is, it will list which php confi file is in effect and where its located.

My thoughts behind this is that I have a similar issue and there was an additional php config file inside the home folder of that virtual server. After I edited that file and restarted php, it was fine.

1 Like

Thanks for your answer @DrCarsonBeckett :slight_smile:

I tried to restart and reload php with the commande:

sudo service php7.3-fpm restart
sudo service php7.3-fpm reload

and tried to upload the file (5MB) and same thing…

Where I have to create this file with the php code ? I looked into the root/home but I didn’t see any php.ini.

Let me rephrase it, you need to put that code into a .php file (name-here.php) and upload it into your website which is affected by that limited upload. :slight_smile:

I use the command

find . -name “php.ini”

and I saw that there is a php.ini for each user. I edited the one for my website and the max_upload_size was 2M so I changed it for 10M and I have restarted php but, again, same error.
I change also the file in:

/etc/php/7.3/php.ini

who was also again set on 2M, restart php and again, same error.
I will try the php file in the / of Wordpress and see what happens…

Configuration File (php.ini) Path /etc/php/7.3/cgi

I checked the php.ini in this folder and it’s 10M for the upload_max_filesize
and I have also:

Loaded Configuration File /home/myuser/etc/php7.3/php.in

and same settings here… 10M.
I restarted php twice too…

I restarted Apache Webserver and PHP-FPM 7.3.11 Server in Webmin and now it works finally!
I don’t know why the restart command didn’t work but…

Thanks @DrCarsonBeckett :slight_smile:

Glad you could manage. :slight_smile:

1 Like

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.