My notes and thoughts about Linux, WordPress, PHP, WPML, Toolset and many more.
This quick tutorial shows how you can override
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.
phpinfo.php. Scroll down and find the field of
$_SERVER['SERVER_SOFTWARE']. It should contain Apache. See screenshot:
.user.iniwith the following settings to override
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
.user.inifile is created, restart your Apache server and PHP-FPM:
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.
phpinfo()output and confirm that the Local value is now correct. This value is meant to be active for the specific site with the
.user.iniand not applied to all sites in your server.
.user.iniin your WordPress root directory ). But it will take some time for the settings to take effect. After you have put the correct value in your
.user.ini. You need to refresh your page and wait for like several minutes for the settings to be reflected in your phpinfo. But if you want the fastest results, you will simply need to restart Apache and PHP-FPM.
memory_limitas well. Please read the following guidelines on setting these values correctly:
.user.inifrom being publicly viewed by adding these lines to your
Deny from all