Question
Hello, I need to increase the PHP Max. Input Vars and PHP Max. Input Time to install a theme in wordpress.
I’m using nginx on ubuntu 18.04 with easyengine commands. The php version is 7.2 and the path for php.ini is etc/php/7.2/cli/php.ini
In putty used sudo nano /etc/php/7.2/cli/php.ini and after change max_imput_vars and max_imput_time restarted nginx with sudo service nginx restart
Can someone help here? I’ve seen others with fpm instead of cli paths. I’m a noob and I’m stuck. Thanks.
Submit an answer
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Sign In or Sign Up to Answer
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
helyosPosts: 43Joined: Wed Aug 19, 2015 1:21
pm
max_input_vars with NGINX
I have installed on Centos 7 Vesta with NGINX + PHP-FPM and I wanna modify max_input_vars for Wordpress site.
If I put in wp-config.php @ini_set[ 'max_input_vars' , 3000 ] does not work.
Do you have any ideea why? Or what should i do to make the modification?
Thanks
helyosPosts: 43Joined: Wed Aug 19, 2015 1:21 pm
Re: max_input_vars with NGINX
Post by helyos » Mon Mar 08, 2021 2:39 pm
In /etc/php.ini i have:
; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 2000
But still somehow Wordpress shows me:
max_input_vars 1000
Do you have any ideea why?
Thank you a lot
I'm getting a max_input_vars
error message.
I understand there's a php.ini
setting that can change this starting with version 5.3.9 however, I'm running version 5.1.6.
When I view the configuration information for my 5.1.6 server it shows max_input_vars
value is 1000.
My question is: Even though I'm running
5.1.6, I see this setting from phpinfo[]
but it's not in the php.ini
file. Does this mean that the value is hard coded in this version of PHP and can't be changed?
zessx
67.1k28 gold badges131 silver badges155 bronze badges
asked Apr 24, 2012 at 18:18
9
Reference on PHP net:
//php.net/manual/en/info.configuration.php#ini.max-input-vars
Please note, you cannot set this directive in run-time with function ini_set[name, newValue]
, e.g.
ini_set['max_input_vars', 3000];
It will not work.
As explained in documentation, this directive may only be set per directory scope, which means via .htaccess file, httpd.conf or .user.ini [since PHP 5.3].
See //php.net/manual/en/configuration.changes.modes.php
Adding the directive into php.ini or placing following lines into .htaccess will work:
php_value max_input_vars 3000
php_value suhosin.get.max_vars 3000
php_value suhosin.post.max_vars 3000
php_value suhosin.request.max_vars 3000
answered Jan 4, 2013 at 23:12
lubosdzlubosdz
3,9822 gold badges28 silver badges40 bronze badges
5
You can add it to php.ini and it should work - just tested it on PHP 5.3.6.
answered Apr 24, 2012 at 18:32
NarfNarf
14.4k3 gold badges36 silver badges65 bronze badges
3
Have just attempted this fix with 5.3.3 and there's no change. Googling around I found this web page //anothersysadmin.wordpress.com/2012/02/16/php-5-3-max_input_vars-and-big-forms/ detailing other settings which need changing if your server uses the Suhosin patch which Apache under Debian does.
The site explains:
So, if you want to increase this number to, say, 3000 from the default number which is 1000, you have to put in your php.ini these lines:
max_input_vars = 3000 suhosin.post.max_vars = 3000 suhosin.request.max_vars = 3000
I tested it [added settings to php.ini both in /etc/php5/apache2 and /etc/php5/cli, and restarted Apache successfully] but still no max_input_vars variable in phpinfo.
A few sites point to PHP 5.3.9 as the first PHP version in which this change will take, so my fault for not RTM properly in the first place, although I'm interested to see people reporting it working in version above 5.3.3 but below 5.3.9.
answered Jul 5, 2012 at 7:52
VaughanyVaughany
95314 silver badges21 bronze badges
1
It's 2018 now.And I just got stuck on this problem when I must send a request that exceeds the max_input_vars
. And I came up with a solution that newie like me forgot to restart php fpm service after changing the max_input_vars
param. because I only tried to restart apache2
service, but not php fpm
- uncomment code at
/etc/php/7.0/fpm/php.ini
and set number as you wish
max_input_vars = 4000
- restart php fpm service,
as I use php 7. Therefore,
sudo service php7.0-fpm restart
Hope it helps
Tested on Debian Stretch
, php7.0
answered Feb 20, 2018 at 17:10
nokiengnokieng
1,67219 silver badges21 bronze badges
2
You need to uncomment max_input_vars value in php.ini file and increase it [exp. 2000], also dont forget to restart your server this will help for 99,99%.
answered Apr 30, 2014 at 8:47
3
Use of this directive mitigates the possibility of denial of service attacks which use hash collisions. If there are more input variables than specified by this directive, an E_WARNING is issued, and further input variables are truncated from the request.
I can suggest not to extend the default value which is 1000 and extend the application functionality by serialising the request or send the request by blocks. Otherwise, you can extend this to configuration needed.
It definitely needs to set up in the php.ini
answered Sep 8, 2016 at 12:57
Note that you must put this in the file ".user.ini" in Centos7 rather than "php.ini" which used to work in Centos6. You can put ".user.ini" in any subdirectory in order to affect only that directory.
.user.ini :
max_input_vars = 3000
Tested on Centos7 and PHP 5.6.33.
answered Feb 20, 2018 at 6:07
Gary SamadGary Samad
7635 silver badges14 bronze badges
php_value max_input_vars 6000
"Put this line on .htaccess file of your site. "
answered May 2, 2018 at 9:54
Rahul K ARahul K A
3023 silver badges4 bronze badges
1
Just had the same problem adding menu items to Wordpress. I am using Wordpress 4.9.9 on Ubuntu 18.04, PHP 7.0. I simply uncommented the following line and increased it to 1500 in /etc/php/7.0/apache2/php.ini
; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 1500
Then used the following to effect the change:
sudo apache2ctl configtest #[if it does not return ok Apache will not start]
sudo service apache2 reload
Hope that helps.
atline
24.6k15 gold badges59 silver badges93 bronze badges
answered Jan 21, 2019 at 6:46
"PHP message: PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini.
This php configuration parameter max_input_vars will affect not only your GET / POST / COOKIES parameters it also controls your any Form Input.
To set or change its value follow the below steps.
1] check the existing setting / value by viewing it in your php.ini file Locate php.ini file by using
find below key: Loaded Configuration File : /etc/php/5.6/fpm/php.ini
2] Open the php.ini file in editable mode and do search for max_input_vars This line may be commented in your existing default setting with default value of 1000 , So remove ; to uncomment it and Edit it with your suitable value e.g. 2500.
3] Save the file and Restart the Services of PHP by using below sudo service php5.6-fpm restart
Similarly you can update any other similar PHP Configuration to your ease.
answered Aug 28, 2019 at 7:28
Just to complement. On a shared server using mod_suphp I was having the same issue.
Declaring 4 max_input_vars [suhosin included], didn't solved it, it just kept truncating on 1000 vars [default], and declaring "php_value max_input_vars 6000" on .htaccess threw error 500.
What solved it was to add the following on .htaccess, which applies the php.ini file recursively to that path
suPHP_ConfigPath /home/myuser/public_html
answered Dec 24, 2019 at 13:32
If you are using something like wodby [docker4php
or docker4drupal
] or lando or trying to find an answer "why php.ini doesn't work" [like me], these tools are using their own way to pass configuration into php
//github.com/wodby/php#php-and-php-fpm-configuration
I was trying to set max_input_vars, in wodby+docker-compose you do it like so
php:
image: wodby/drupal-php:$PHP_TAG
container_name: "${PROJECT_NAME}_php"
environment:
PHP_MAX_INPUT_VARS: 9999
answered Dec 30, 2021 at 17:13
mevsmemevsme
3701 silver badge13 bronze badges
New Cpanels block to see the .htaccess file or if you add a .user.ini you wont be able to see it. but with a little hack you can make it work. Edit for example wp-config.php and in the URL bar replace wp-config.php by .htaccess now you can paste the values and save it. enter image description here
answered Mar 29, 2018 at 22:10
Yes, add it to the php.ini, restart apache and it should work.
You can test it on the fly if you want to with ini_set["max_input_vars",100]
IluTov
6,6756 gold badges37 silver badges99 bronze badges
answered Apr 24, 2012 at 18:47
QuaidQuaid
2331 silver badge7 bronze badges
3