I’d like my site visitors to be able to upload photos through a simple form. I’m using Statamic CMS (v2) that’s been deployed via Laravel Forge.

I’ve added client_max_body_size 20M; in the http section of my nginx.conf file (/etc/nginx/nginx.conf);

I’ve also modified upload_max_filesize and post_max_sizein two php.ini files (/etc/php/7.4/fpm/php.ini and /etc/php/7.4/cli/php.ini), both to allow 20mb file uploads.

After those modifications I restarted my nginx web server (systemctl restart nginx).

The good thing: when I try to upload a file larger than 2 mb and submit the form, I no longer get a ‘431 entity too large’ error, but the form just seems to doesn’t work. Like it submits the entry into the void.

Am I overlooking something?

Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hello, kvkooten

Could you please confirm that the uploadmaxfilesize change has taken effect? What you can do is to create an info.php file and then check the value. You can create a file named info.php (the name doesn’t really matter) and put the following content in the file:

<?php

phpinfo();

Then all you need to do is to access the file in your browser and you’ll see all the information about the php extensions and values as well.

Additionally you can examine the Nginx and the PHP errorlogs for any logged references that can help us to locate the issue. You can also try increasing the “`memorylimit,maxinputtimeandmaxexecutiontime”` values.

Regards,
Alex

  • Hey Alex,

    The info.php file shows that upload_max_filesize has ‘20M’ for both local value and master value.

    I’m pretty new to DigitalOcean — could you point me in the right direction where I can find my Nginx and PHP error logs?

    Also, the memorylimit, maxinputtime and maxexecutiontimevalues — do I find those in php.ini? What would you suggest I change them to?

    Thanks in advance,
    Kaz

    • Hello,

      You can use the following values in the php.ini file:

      memory_limit = 256M
      max_execution_time = 30
      max_input_time=60
      

      default for maxinputtime is -1 which is Unlimited so if you wish you can leave it like that but it’s a good
      idea to limit this time on productions servers in order to eliminate unexpectedly long running scripts.

      Regards,
      Alex

Show answer This answer has been marked as resolved by kvkooten.
Submit an Answer