4

I am trying to change the variable max_input_vars in my php.ini file by specifying

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 2500

and running

sudo nginx -s reload

Even though I set this variable to 2500 on both my local machine (C:\xampp\php\php.ini) and on Homestead (/etc/php5/fpm/php.ini), I keep receiving the following error message

  parse_str(): Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini

I know .htaccess overrides php.ini on a per site basis, are there any other files which override php.ini? Are there any other services that need to be reloaded after changing the php.ini file?

jstein
  • 633
  • 1
  • 8
  • 14

4 Answers4

5

On the latest laravel homestead, php.ini is located in

/etc/php/7.0/fpm/php.ini

(Make sure you enter into ssh in to the homestead environment)

try to edit it using

sudo su
mpalencia
  • 5,481
  • 4
  • 45
  • 59
3

Have you tried this?

ini_set('max_input_vars', 2500);

At the beginning of this file bootstrap/autoload.php

rigobcastro
  • 1,258
  • 11
  • 18
  • Thank you for the suggestion! Yes, I tried calling that method, but it didn't seem to make a difference. Can you think of anything else that might work instead? – jstein Sep 24 '15 at 13:14
  • Sure, remember change "max_input_vars" and "post_max_size" too. Try it. – rigobcastro Sep 24 '15 at 15:00
  • No luck. Would I need to change the HandleExceptions class so that it doesn't throw an error if there are more than 1000 input vars? – jstein Sep 28 '15 at 20:15
  • Do you have any xdebug error? If this is your case then place this code ini_set('xdebug.max_nesting_level', 120); in the top of bootstrap/autoload.php – rigobcastro Sep 29 '15 at 17:59
  • Well it turns out that adding my application to the hosts file and the .env file fixed the problem. For some reason the max_input_vars is only an issue when running off `php artisan serve`. I am going to accept this as the correct answer, but if you have any insight into where the configuration file is for `php artisan serve`, I would be interested in hearing it. – jstein Sep 30 '15 at 01:55
  • 3
    I also learned that the command `php --ini` displays the loaded configuration files and values – jstein Oct 01 '15 at 16:24
  • The second argument must be a string: http://php.net/manual/en/function.ini-set.php. .htaccess seems to be required: https://stackoverflow.com/a/14166562/5296404 – Pierre Cordier Jun 19 '18 at 10:27
1

i had this problem in laravel

i added

ini_set('max_input_vars', 2500);

in server.php when use laravel

saber tabatabaee yazdi
  • 4,404
  • 3
  • 42
  • 58
0

SSH to the virtual machine:

homestead ssh

The latest version of PHP in Homestead is 7.1. Edit the corresponding php.ini file:

sudo vim /etc/php/7.1/fpm/php.ini 

Search for max_input_vars and change its value.

Jerome Jaglale
  • 1,863
  • 18
  • 22
theRana
  • 704
  • 9
  • 10