Reputation: 13
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.
Upvotes: 1
Views: 7677
Reputation: 812
In PHP 8.1 trick is to find correct loded php.ini file for Web Server (Apache)
What I have found for Ubuntu and PHP 8.1 is that, command "php --ini" is showing loaded confirmation file for CLI not Apache2. See below image.
So I have to find the php.ini file in same php 8.1 folder for Apache2 and set the max_input_vars to 5000 .
Upvotes: 0
Reputation: 81
In my case it was the wrong php.ini file I edited. The comment from @JacobMulquin directly to the question and the answer from @RusselEngland helped me find that out.
I have a webserver (Ubuntu 22.04 LTS) running with multiple PHP versions as fpm, and therefore I had to edit the /etc/php/8.3/fpm/php.ini instead of the /etc/php/8.3/apache2/php.ini.
I thought this should be posted as an answer so others struggling with the same problem may find it faster.
Upvotes: 1
Reputation: 2553
I had the same error in Moodle installer on Fedora. After changing /etc/php.ini
with
max_input_vars = 5000
error would not go away even after max_input_vars
changed. Appears it is not enough to restart web server (apache in my case)
sudo systemctl restart httpd
also needed to
sudo systemctl restart php-fpm.service
Upvotes: 0
Reputation: 10221
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
Upvotes: 2