My notes and thoughts about Linux, WordPress, PHP and many more.
This quick tutorial shows how you can override `upload_max_filesize` and `post_max_size` on a per site basis. This assumes you are using Apache server, PHP-FPM handler and WordPress. This tutorial assumes you have shell access to your server so you can restart Apache or PHP-FPM (this is optional but recommended).
By default, there is only one default `php.ini` loaded on a server. Sometimes some virtual sites in your server might need specific configuration values that you don’t want to be applied globally.
These are the steps to fix this:
To determine if you are using PHP-FPM handler is to check the value of Server API. In the above screenshot it’s FPM/FastCGI. So that’s correct.
upload_max_filesize=200M post_max_size=500M
The above example shows that you want to override `upload_max_filesize` with 200 Megabytes and `post_max_size` with 500 Megabytes
Make sure its on the root directory of WordPress. Als make sure to put a dot sign before the file name as this is a hidden configuration file like `.htaccess`. This is how it looks like when this file is created:
It’s on the same path as the `wp-load.php`, etc.
sudo service php7.0-fpm reload; sudo service apache2 restart;
It assumes you are using PHP 7.0. If you are using PHP 5.7, simply replace php7.0-fpm with php5.6-fpm.
<Files .user.ini> Order allow,deny Deny from all </Files>