Home > Mobile >  Can't change max_input_vars limit in php.ini
Can't change max_input_vars limit in php.ini

Time:03-02

I need to change PHP max_input_vars variable but after change in php.ini and server restart phpinfo shows old value all the time. This is what i do:

in phpinfo() i've got

...
Loaded Configuration File /etc/php.ini
...
max_input_vars  1000

from server CL I've edit /etc/php.ini and uncomment line with max_input_vars it looks like this:

...
max_input_vars = 5000
...

after this changes and restarting web server

systemctl restart httpd

phpinfo still shows max_input_vars as 1000 It looks like php use some other php.ini or values are overwritten because with other settings like max_execution_time is the same.

If i'm doing it wrong way? Is this possible that phpinfo shows different configuration file than the one used?

phpinfo output:

phpinfo output

CodePudding user response:

As you're using PHP-FPM, you need to check it's configs for overrides, typically in /etc/php-fpm/*.conf.

php_admin_value[max_input_vars] = XXX

After validating there are no overrides that affect your settings, restart the php-fpm service and as a best-practice also Apache.

systemctl restart php-fpm httpd

Restarting the PHP-FPM service is required because Apache passes requests to the running PHP instance(s) loaded into memory from the PHP-FPM service. As PHP is already loaded into memory by PHP-FPM, the PHP-FPM service needs to be restarted for PHP configuration changes to be applied.

Apache prior to PHP-FPM typically relied on starting the PHP process using the Apache mod_php, thereby requiring the restarting of the Apache service for configuration changes to be applied immediately, or until mod_php reloaded the PHP instance.


Based on your configuration, you should add additional PHP config settings to /etc/php.d/zzz-custom.ini instead of /etc/php.ini. PHP will load the config files in alphabetical order, resulting in the zzz-custom.ini file being loaded last and be used as the final values of the PHP settings.
Using the /etc/php.d/zzz-custom.ini file will also prevent the loss of your custom php.ini settings and the need to make extensive changes to the default /etc/php.ini file when updating PHP versions.
However, /etc/php-fpm/*.conf settings will take precedent over any /etc/php.d/*.ini configs.

CodePudding user response:

first: Method is edit the PHP. ini file Locate your PHP. ini file. ... If you find your existing PHP. ini, open the file and locate the following line of code (xx represents a number): max_input_vars = xx ; And set it to your desired limit. ... If you created your own PHP. ... Save your changes, and reboot your localhost or your server.

  •  Tags:  
  • php
  • Related