skip to Main Content

I have a nginx server with a php-fpm backend.

On the nginx server, I have a client_max_body_size limiting the upload of anything.

So I decide to disable post_max_size and upload_max_size? They are already limited by the nginx server anyway… And this would avoid duplicate limitation and configuration.

To do that, I did try to set them

post_max_size = 0
upload_max_filesize = 0

which seem to do the job, while partially documented.

Is this setup safe?

2

Answers


  1. Chosen as BEST ANSWER

    This response is not (yet) factual.

    Since the NGINX limit the upload size, the limit is de facto applied to any communication to the PHP. The limit in the PHP is thus not necessary.

    But this point is based on the fact that NGINX is doing the job correctly.


  2. The documentation of post_max_size says in the Changelog:

    5.3.2 , 5.2.12 Allow unlimited post size by setting post_max_size to 0.

    so the correct value is 0, not -1. The changelog for 5.3.4 says that this doesn’t work when the content type is application/x-www-form-urlencoded. But since you have to use multipart/form-data to upload files, this isn’t relevant when you want to allow large file uploads.

    The documentation of upload_max_size doesn’t say how to make it unlimited, but it seems likely that it would be the same. It should be simple to verify this expectation, and you could submit a bug report to fix the documentation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search