It all started on a day when I had to increase the size of a file upload field in Drupal. Changing upload_max_filesize and post_max_size in php.ini wasn’t enough as those needed to be changed in the server’s config as well, Nginx in my case. Below are the steps I took during this small journey:
- Increase file size in php.ini
upload_max_filesize = 400M
post_max_size = 400M
- Increase max body size in /etc/nginx/performance-security.conf.inc
- Restart Nginx
$ service nginx restart
Now, at this point I could upload bigger files. But it was still showing 64MB in Drupal’s admin. My logic somehow states that Drupal uses php_values to get the server’s file upload size limit set in Nginx. I wasn’t very sure where the php_values had to be set at the server level at first, but finally figured out that /etc/php-fpm.d/www.conf was the one I wanted to look into.
- Add php_values to /etc/php-fpm.d/www.conf
php_value[upload_max_filesize] = 400M
php_value[post_max_size] = 400M
- Restart php-fpm
$ service php-fpm restart
And last but not least, refreshing the admin page then showed the correct file size limit. I hope this will save someone some precious time.