maxinputvars
Read or set PHP
max_input_vars(the most input variables PHP accepts per request for each of GET, POST, and cookies; default 3000) across all php.ini files, then reload PHP-FPM a minute later
- Command:
/go/maxinputvars - Category: PHP
- Required option: None. With no value, it sets
3000. - Output: Plain text
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/maxinputvars sets PHP's max_input_vars in the php.ini file of every installed PHP version at once. This is the maximum number of input variables PHP accepts in one request, counted separately for GET (the address), POST (form data), and cookies. Each form field counts, and so does every item in an array field such as items[]. The command:
- finds the php.ini files for the PHP-FPM, command-line, and Apache versions of each installed PHP version
- replaces the existing
max_input_varsline, or adds one if there is none - schedules a PHP-FPM reload one minute later, so the new value takes effect without further steps
- can also print the current value instead of changing it
PHP's own default is 1000. Pages that send very large forms (for example a content management system's menu editor or a product with many variations) can exceed it. When a request goes over the limit, PHP silently drops the extra variables, so part of the form may not be saved.
Quick start
# Set the default (3000 variables per request) in every php.ini
/go/maxinputvars
The new value is live about a minute later.
Syntax
/go/maxinputvars [number]
/go/maxinputvars return
| Form | Behavior |
|---|---|
/go/maxinputvars |
Sets max_input_vars = 3000 in every php.ini file. |
/go/maxinputvars <number> |
Sets that value in every php.ini file. |
/go/maxinputvars return |
Prints the current value and changes nothing. The word is not case-sensitive. |
If the first argument starts with -- (for example --force), it is ignored and 3000 is set.
Options
This command has no options. It takes one optional argument.
| Argument | Required | Default | Notes |
|---|---|---|---|
<number> |
No | 3000 |
A whole number of variables. Nothing checks the value (see Validation). |
return |
No | — | Prints the current value instead of setting one. |
Output
| Outcome | What you get |
|---|---|
| Value set | Max Input Vars updated successfully. |
return |
The number from the first php.ini found. Blank if that file has no max_input_vars line starting at the beginning of a line. |
| Unsupported operating system | Unknown operating system. Nothing is changed. |
The success message is printed even if no php.ini file was found, so it does not prove that anything changed. Check with return.
The scheduled reload prints nothing. Every run is also recorded in /var/log/go/maxinputvars.log.
[!NOTE]
returnends with exit status1, andreturndoes not schedule a reload. In scripts, read the output instead of relying on the exit status.
Examples
# Use the default of 3000 variables
/go/maxinputvars
# Allow 5000 variables per request
/go/maxinputvars 5000
# Show the current value
/go/maxinputvars return
# Apply the change immediately instead of waiting for the scheduled reload
/go/maxinputvars 5000 && /go/fpm
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Part of a large form is not saved, with no error | The request has more variables than max_input_vars, and PHP dropped the extra ones. |
Raise the value, for example /go/maxinputvars 5000. |
The old value still shows in phpinfo() right after the command |
The PHP-FPM reload is scheduled for one minute later. | Wait a minute, or run fpm now. |
| The value is still old after several minutes | The reload is scheduled with at. If at isn't installed or its service isn't running, the job fails silently. |
Install at and start its service, then run /go/fpm reload. |
| A site on Apache with mod_php still uses the old value | The scheduled reload covers PHP-FPM only. | Reload the web server, for example with web. |
| Very large forms still fail | The request is bigger than post_max_size, or another limit is reached. |
Check postmaxsize and your web server's request size limit. |
| A site uses a different value | A setting for that site (for example in its PHP-FPM pool or a .user.ini file) can override php.ini. |
Change it where it is set. |
return prints nothing |
The first php.ini has no max_input_vars line starting at the beginning of a line. |
Run /go/maxinputvars <number> to add it. |
return shows a different value than one version uses |
return reports only the first php.ini file found. |
Open the other versions' php.ini files to compare. |
Unknown operating system. |
The operating system name in /usr/local/goadmio/linux/os.db isn't one the script knows. |
The script supports AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, and Ubuntu. |
Permission denied |
The command was not run as root. Adding a missing line writes to the file without sudo. |
Run it as root. |
| PHP reports a syntax error in php.ini after a change | A non-numeric value, or several words, was passed and written as is. | Run /go/maxinputvars <number> again with one number, or use checkphpini. |
| Success message, but no file changed | No php.ini files exist at the expected paths. | Check the paths in Files it changes. |
Details
Files it changes
The script reads the operating system from /usr/local/goadmio/linux/os.db. Only files that exist are changed.
| Operating system | Files |
|---|---|
| AlmaLinux, Rocky, CentOS, Red Hat, Fedora | /etc/php.ini, and /etc/opt/remi/<version>/php.ini for each version found |
| Debian, Ubuntu | /etc/php.ini, and for each version in /etc/php/: <version>/fpm/php.ini, <version>/cli/php.ini, and <version>/apache2/php.ini |
How a value is written
For each php.ini file:
| Situation | Result |
|---|---|
An uncommented max_input_vars = line exists |
Every such line is replaced with max_input_vars = <value>. |
The setting is missing, or only exists as a comment (;max_input_vars = 1000) |
A new max_input_vars = <value> line is added at the end of the file. |
If the file's last line has no trailing newline, the added line may be joined to it. Check the file if PHP reports an error after the change.
Validation
The command does not check the value. Everything after the command name is written as typed, so 5000 6000 or abc ends up in php.ini as is. Pass a single whole number.
The scheduled reload
After the files are changed, the command checks the queue of scheduled jobs (atq). If no /go/fpm reload job is already waiting, it schedules /go/fpm reload to run one minute later.
- Running the command several times within a minute schedules only one reload.
- A queued job such as a plain
/go/fpmis not recognized, so a second reload may still be scheduled. - The job is created silently. Errors from
atare not shown. - Run the command as root, so the queue check sees every user's jobs.
What it does not change
- PHP-FPM pool settings and values set inside applications.
- Web server request limits, such as Nginx's
client_max_body_size. post_max_size, which limits the total size of a request. Seepostmaxsize.
See also
| Command | Description |
|---|---|
postmaxsize |
Read or set PHP post_max_size across all php.ini files |
maxfileuploads |
Read or set PHP max_file_uploads across all php.ini files |
maxinputtime |
Read or set PHP max_input_time across all php.ini files |
maxexecutiontime |
Change the max execution time for all PHP versions |
uploadmaxfilesize |
Read or set PHP upload_max_filesize across all php.ini files |
checkphpini |
Scan every php.ini on the server for startup errors and delete the line that causes each one |
fpm |
Restart all installed PHP-FPM versions on your server |