Trouble changing `upload_max_filesize` on nginx

I’ve see a few other similar questions on here, but most of the answers are Apache specific (dealing with their .htaccess file) and I’m using nginx.

I’m having trouble making my change to the upload_max_filesize in php.ini stick. I’m using nginx, php5 and wordpress on Debian.

Read More

When I run phpinfo() I see the following output:

Loaded Configuration File /etc/php5/cgi/php.ini

I then go to the relevant .ini file, change a few values, and then restart nginx. When I fire up a phpinfo() plugin I got for wordpress, it reports the values as unchanged.

I’m at a loss because phpinfo() reports that it is loading config values from the file that I’ve changed, but it doesn’t report the changes.

Related posts

Leave a Reply

4 comments

  1. You might be using FAST CGI:

    [webserver] <----> [fcgi daemon]
                            `- [php]
    

    If you restart the webserver, PHP is not restarted, so still has the old ini values because it didn’t reload the ini file.

    Restarting the fcgi daemon solves that issue, PHP will be restarted, re-reading the ini.

    Some fcgi daemons have a command that reloads the child processes more gracefully. Depends on what you use.

  2. This might help the ones that are using php -i from the terminal to check php.ini settings.

    In my case, I increased the upload_max_filesize from 2M to 20 MB by editing /etc/php/7.3/apache2/php.ini and restarted the apache by apachectl restart command.

    I used php -i command from the Debian terminal to see the changes are in effect but upload_max_filesize was still 2M.

    Then I realized settings readings came from /etc/php/7.3/cli/php.ini because I was using php -i from the terminal instead of phpinfo() function in a web page.