GoAdmio

maxinputtime

Read or set PHP max_input_time (the seconds PHP may spend parsing request data such as forms and uploads; default 600) across all php.ini files, then reload PHP-FPM a minute later

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/maxinputtime sets PHP's max_input_time in the php.ini file of every installed PHP version at once. This is the longest PHP may spend reading and parsing the data sent to a script, such as form fields and uploaded files. It does not limit how long the script itself runs (see maxexecutiontime). The command:

Slow connections uploading large files are the usual reason to raise this value.


Quick start

# Set the default (600 seconds) in every php.ini
/go/maxinputtime

The new value is live about a minute later.


Syntax

/go/maxinputtime [seconds]
/go/maxinputtime return
Form Behavior
/go/maxinputtime Sets max_input_time = 600 in every php.ini file.
/go/maxinputtime <seconds> Sets that value in every php.ini file.
/go/maxinputtime 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 600 is set.


Options

This command has no options. It takes one optional argument.

Argument Required Default Notes
<seconds> No 600 A whole number. Nothing checks the value (see Validation).
return No — Prints the current value instead of setting one.

What the value means to PHP:

Value Meaning
A positive number PHP may spend that many seconds parsing input.
0 No limit.
-1 PHP uses max_execution_time instead. This is PHP's own default when nothing is set.

Output

Outcome What you get
Value set Max Input Time updated successfully.
return The value from the first php.ini found. Blank if that file has no max_input_time line.

When a php.ini file already has a max_input_time line at the start of a line, that line is printed first, once per file, showing the previous value. For example:

max_input_time = 60
max_input_time = 60
Max Input Time updated successfully.

These extra lines are normal and can be read as a before-picture. They are not errors.

The success message is printed even if no php.ini file was found, so it does not prove that anything changed. This includes servers whose operating system the script doesn't recognize, which is not reported. Check with return.

The scheduled reload prints nothing. Every run is also recorded in /var/log/go/maxinputtime.log.

[!NOTE] return ends with exit status 1, and return does not schedule a reload. In scripts, read the output instead of relying on the exit status.


Examples

# Use the default of 600 seconds
/go/maxinputtime
# Allow 5 minutes for slow uploads
/go/maxinputtime 300
# Make PHP use max_execution_time instead
/go/maxinputtime -1
# Show the current value
/go/maxinputtime return
# Apply the change immediately instead of waiting for the scheduled reload
/go/maxinputtime 300 && /go/fpm

Troubleshooting

Symptom Likely cause Fix
Extra lines like max_input_time = 60 are printed They are the previous values, printed once per php.ini file. Nothing. This is normal.
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.
Success message, but no file changed The operating system name in /usr/local/goadmio/linux/os.db isn't AlmaLinux, Rocky, CentOS, Red Hat, Fedora, Debian, or Ubuntu, or no php.ini files exist at the expected paths. Check the file paths in Files it changes.
Large uploads still fail Other limits apply: execution time, file size, request size, or web server timeouts. Check maxexecutiontime, uploadmaxfilesize, and postmaxsize.
A site uses a different value max_input_time can also be set in server or PHP-FPM pool configuration, which overrides php.ini. Change it where it is set.
return prints nothing, or a value starting with ; The first php.ini has no max_input_time line, or only a commented line without spaces (such as ;max_input_time=60). Run /go/maxinputtime <seconds> to add a real line.
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.
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/maxinputtime <seconds> again with one number, or use checkphpini.

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
A line starting with max_input_time exists Every line that contains max_input_time is rewritten from that text to the end of the line as max_input_time = <value>. This includes commented lines, which stay commented.
The setting is missing, only exists as a comment, or the line is indented A new max_input_time = <value> line is added at the end of the file. PHP uses the last value it reads.

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.

How return reads the value

It looks for a line that starts with max_input_time = (with spaces). If there is none, it looks for any line containing max_input_time= (no spaces), even a commented one, and removes the name from the line. The first php.ini found is used, so the result can differ from other versions.

Validation

The command does not check the value. Everything after the command name is written as typed, so 300 600 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.

What it does not change


See also

Command Description
maxexecutiontime Change the max execution time for all PHP versions
maxfileuploads Read or set PHP max_file_uploads across all php.ini files
maxinputvars Read or set PHP max_input_vars across all php.ini files
uploadmaxfilesize Read or set PHP upload_max_filesize across all php.ini files
postmaxsize Read or set PHP post_max_size 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