3

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.

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.

Josh Mohan
  • 496
  • 6
  • 15
  • 2
    Please restart your whole server (reboot) and tell if the values are changed or not. – hakre Nov 06 '11 at 17:04
  • Wow, that totally was the problem. I'm new to VPS hosting, thanks for the help! – Josh Mohan Nov 06 '11 at 17:24
  • You might be using a FCGI (Fast CGI) interface to PHP. Instead of rebooting the server or restarting the webserver, you just need to restart the PHP FCGI daemon then. Rebooting your computer does that, I just wanted to check if this might be the issue. – hakre Nov 06 '11 at 17:26

4 Answers4

10

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.

hakre
  • 193,403
  • 52
  • 435
  • 836
0

For me the problem was a syntax error in the custom php.ini file, which I found after checking the error logs.

Jeff
  • 12,555
  • 5
  • 33
  • 60
0

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.

Arda Basoglu
  • 1,420
  • 1
  • 12
  • 6
-1
$ sudo service php7.4-fpm restart

Resolved my problem. change the php version to the one you using.

Joel Davey
  • 2,363
  • 1
  • 21
  • 20
  • Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach? – Tyler2P Feb 13 '22 at 12:18