PHP / Nginx: set max file upload and post size

Last updated on

Firstly, you need to locate your php.ini file. In this example, our php.ini file is located in /etc/php/7.0/fpm/php.ini

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

In nano, press CTRL + W and search for upload_max_filesize and change the value to 64M (for 64 megabytes).

/etc/php/7.0/fpm/php.ini
...
upload_max_filesize = 64M
...

Press CTRL + W again and search for post_max_size and change the value to 64M (for 64 megabytes).

/etc/php/7.0/fpm/php.ini
...
post_max_size = 64M
...

Save file and exit. (Press CTRL + X, press Y and then press ENTER

Now restart PHP-FPM

service php7.0-fpm restart

You may also need to edit the Nginx configuration file.

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.

Leave a reply

Your email address will not be published.