php.ini upload_max_filesize does not work in php-fpm problem

286 阅读1分钟

I encountered an weird problem this afternoon, after i modified the upload_max_filesize option to 4M in php.ini, and restarted php-fpm, the phpinfo function still output upload_max_filesize as 2M, so the modification did not take into effect.
The following steps were what i did:

  1. modify the upload_max_filesize to 4M in php.ini
  2. restart php-fpm service
  3. verify that the modified php.ini is the loaded configuration of php-fpm.
  4. check phpinfo(), the upload_max_filesize is still 2M

After some searching and browsing on the internet, i found a valid solution that worked for this weird problem,

fastcgi_param PHP_VALUE "upload_max_filesize=4M";

After adding the above item into .php${} block, and reloading nginx, it worked.
So maybe next time when you change an option of php.ini but it does not work, take the above solution into consideration. It is amazing~