Search code examples
phpapache2moodlevirtualmin

Can't change max_input_vars in PHP


I need to raise the max_input_vars value in php for a moodle installation. However when I change the value in my php.ini file the moodle web installer still prompts:

PHP setting max_input_vars must be at least 5000.

phpinfo() shows:

max_input_vars => 5000 => 5000

also editing the .htaccess file had no effect.


Solution

  • Create a temporary php file in the Moodle directory with the following and run it via the browser (running php via the command line uses a different php ini file not the apache file)

    <?php
    
    phpinfo();
    

    This will confirm which php ini file is being used, eg /etc/php/xx/apache2/php.ini

    Also search the page for max_input_vars to see what the value is.

    Master is the value in php.ini - if its not 5000 then the wrong php ini file has been edited, or you need to restart apache

    Local is the value being used - if its different to the master value, then its been overwritten by apache

    In which case, check .htaccess and the conf files in the apache directories eg etc/apache2/

    If the local value is correct - 5000 - then its been changed by code in the Moodle directory somewhere. Maybe check config.php or search the code for max_input_vars