Out of the box, Prestashop (prompt to change PHP max_input_vars)
Doing a test install. Added one product with a few attributes and combinations.
Was linked to the Product Settings Form and got the following "alert/error"
The value of the PHP.ini setting "max_input_vars" must be increased to 2000 in order to be able to submit the product form.
Hey @l-arnold - By default, we leave that setting as per the PHP default value (1000). To change it you'll need to edit the PHP config file; php.ini. However there are multiple php.ini files and which one you need to edit depends on which PHP implementation/context you are using. Also where you will find it will depend on which version of PHP you are using.
Assuming you are using v18.x (e.g. LAMP of one of the many LAMP based appliances) then you likely have PHP v8.2 (if using v17.x then it'll likely be PHP v7.4). Assuming you're using v18.x the files are as follows (you may not have them all - and if running an alternate PHP version, swap the 8.2 in the path for the version you are using):
CLI (e,g, when running php commands from the commandline): /etc/php/8.2/cli/php.ini
Apache mod_php (default TurnKey LAMP): /etc/php/8.2/apache2/php.ini
FPM (default with Nginx and LigHTTPd - but can also be used with Apache - although we don't): /etc/php/8.2/fpm/php.ini
There is also one for CGI (same path as per above, except cgi instead of cli/apache2/etc), but as PHP CGI is rarely used these days (and I'm pretty sure no TurnKey apps do) it's unlikely you'll have that.
Having said all of that, here's a bash snippet (that you can copy paste into an interactive shell) that will ensure that max_input_vars is enabled and set to 2000. It should change it for any PHP version and all available/installed ways to run PHP. For other setting you need to tweak, just change the value of CONFIG and VALUE:
CONFIG=max_input_vars
VALUE=2000
for f in /etc/php/?.?/*/php.ini; do
cp $f $f.bak
sed -i "/^;* *$CONFIG_VAR *=/ s|^;* *[.*]|\1|g" $f
sed -i "/^CONFIG_VAR *=/ s|=|=$VALUE|" $f
done
Please be aware that I haven't actually tested that, that's just OTTOMH. It should work, but if it doesn't you should find backups of the relevant php.ini files named php.ini.bak.
Whether you do it manually or use my snippet above, after adjusting the php.ini, to have it applied to PHP in the webserver context, restart the relevant service. I.e. systemctl restart apache2 or systemctl restart php-fpm.
Hey @l-arnold,
I just re-read your post and it occurred to me that you are likely building and/or testing an appliance?! Sorry I missed that before... The instructions I gave above were suitable for generic scenario on a LAMP based server that you are running, but not ideal for appliance build code. There is a better and easier way for that scenario!
If you want to change/fix that setting for a specific appliance, you can just add the line PHP_MAX_INPUT_VARS = 2000 in the appliance Makefile.
I don't think that there are actually any that use PHP_MAX_INPUT_VARS yet, but you can see an example of a few other PHP config options in Prestashop. I.e. these lines:
PHP_MEMORY_LIMIT = 256M
PHP_POST_MAX_SIZE = 128M
PHP_UPLOAD_MAX_FILESIZE = 128M
As you can probably guess, they set the following PHP settings (in all relevant php.ini files): memory_limit, post_max_size & upload_max_filesize.
Please be aware though, that you can't just use that to adjust any PHP cpmfog option, only the ones that we've explictly added support for. You can the the supported ones in common/conf/php
Bump @l-arnold
Hi @JedMeister . Th is was on a Prestashop install.. I did change the value "somewhere" but I don't think in common/conf/php and the error went away. I will try to backtrack to what I changed (I did enter a comment about the change).
I was not running TKLDEV, but good to know of where to change that in the Make File... I'll follow up. I need to watch Github a bit more than I do. Somehow the "Bump" itself does not show up any more or less than the general thread. I'll see if I can fix that.
Prestashop seems to really need that 2000 value. I was entering my first product (just had several variations built from it).
FILE changed: /etc/php/7.4/apache2/php.ini
Was line: 405 which was changed, now
405 ; LA changed from 1000 to 2000 and activated 2-12-2024 406 max_input_vars = 2000
Probably a more programatic way to do this.
when i searched on "php.ini" in Webmin Filemanager these were returned. I changed the first one:
[etc/php/7.4/apache2/php.ini
[etc/php/7.4/cli/php.ini
[usr/lib/php/7.4/php.ini-development
[usr/lib/php/7.4/php.ini-production
[usr/lib/php/7.4/php.ini-production.cli
[var/www/prestashop/modules/psaddonsconnect/vendor/doctrine/cache/tests/travis/php.ini
Thanks for the additional info @l-arnold. And if I haven't already said it, thanks heaps for reporting.
FWIW we have a v18.0 release of Prestashop, but I note that this issue still likely exists with it.
I have pinned this issue to the next update (v18.1). And we'll endeavour to add that then.
I also note that on v18.0 Prestashop uses PHP8.1 - so if you use that, you'll need to adjust the php.ini found at /etc/php/8.1/apache2/php.ini.