PHP max_input_time Explained: Configuration, Timeouts, and Best Practices

Published: 2026-07-07
Google AdSense 广告位 (待申请通过后开启)

Introduction

The max_input_time directive defines the maximum amount of time PHP spends parsing input data from a client request. This includes processing POST data, uploaded files, and other request input before the PHP script begins executing.

Unlike max_execution_time, which limits how long a PHP script may run, max_input_time only applies while PHP is receiving and parsing request data.

This guide explains how max_input_time works, how to configure it, recommended values for different applications, and common timeout issues related to file uploads and large form submissions.

Test Environment

Operating System : AlmaLinux 10
PHP Version      : PHP 8.3
Web Server       : Nginx
PHP-FPM          : Enabled
Architecture     : x86_64
Last Tested      : July 2026

What Is max_input_time?

The max_input_time directive specifies the maximum number of seconds PHP spends reading and parsing input data from an HTTP request.

Example:

max_input_time = 60

With this configuration, PHP has 60 seconds to process incoming request data before the script begins execution.

If parsing the request takes longer than the configured limit, PHP terminates the request.

How max_input_time Works

A typical HTTP request follows this sequence:

Browser
    │
    ▼
Send Request
    │
    ├── Form Fields
    ├── Uploaded Files
    └── Cookies
          │
          ▼
PHP Reads Input
(max_input_time)
          │
          ▼
PHP Executes Script
(max_execution_time)

The important point is that max_input_time applies before the PHP script starts running.

Check the Current Value

Run:

php -i | grep max_input_time

Example:

max_input_time => 60 => 60

Locate the Active php.ini File

php --ini

Example:

Loaded Configuration File: /etc/php.ini

If your website uses PHP-FPM, ensure you edit the configuration file used by PHP-FPM.

Change max_input_time

Open the PHP configuration file.

sudo nano /etc/php.ini

Find:

max_input_time = 60

Example:

max_input_time = 300

Save the file.

Restart PHP-FPM

Apply the changes.

sudo systemctl restart php-fpm

Verify:

sudo systemctl status php-fpm

Expected output:

Active: active (running)

Verify the Configuration

Run:

php -i | grep max_input_time

Or create a PHP file:

<?php
phpinfo();

Search for:

max_input_time

max_input_time vs max_execution_time

These directives control different stages of request processing.

| Directive            | Purpose                                                     |
| -------------------- | ----------------------------------------------------------- |
| `max_input_time`     | Limits the time PHP spends reading and parsing request data |
| `max_execution_time` | Limits the time PHP spends executing the script             |

Example:

User uploads a 2 GB file
      │
      ▼
Receiving upload
(max_input_time)
      │
      ▼
PHP starts script
(max_execution_time)
      │
      ▼
Application processes the file

If the upload takes too long to reach PHP, max_input_time may be exceeded before the script even begins.

max_input_time and File Uploads

Large uploads are affected by several configuration directives working together:

Browser
    │
    ▼
Nginx
(client_max_body_size)
    │
    ▼
PHP
    │
    ├── max_input_time
    ├── upload_max_filesize
    ├── post_max_size
    ├── max_execution_time
    └── memory_limit
    │
    ▼
Application

Increasing only one directive may not resolve upload problems if another limit is reached first.

Recommended Values

| Application              |     Recommended Value |
| ------------------------ | --------------------- |
| Small websites           |            60 seconds |
| WordPress                |           120 seconds |
| File upload applications |           300 seconds |
| Large media uploads      |       300–600 seconds |
| Enterprise applications  | According to workload |

Select a value appropriate for your application's upload patterns and expected network conditions.

Common Issues

Large Uploads Fail

Possible causes include:

max_input_time is too low.

upload_max_filesize is too small.

post_max_size is too small.

The web server has its own request timeout.

PHP-FPM has not been restarted.

Slow Network Connections

Users with slower internet connections may require more time to upload large files. Increasing max_input_time can help accommodate these scenarios when large uploads are expected.

Configuration Changes Do Not Apply

Check that:

The correct php.ini file was modified.

PHP-FPM has been restarted.

The updated value appears in phpinfo() or php -i.

Best Practices

Increase max_input_time only when necessary.

Configure upload_max_filesize and post_max_size consistently.

Verify web server timeout settings in addition to PHP configuration.

Restart PHP-FPM after changing configuration values.

Test large uploads under realistic conditions.

Conclusion

The max_input_time directive limits the amount of time PHP spends reading and parsing incoming request data before script execution begins. It plays an important role in applications that handle large file uploads or complex form submissions.

Because file uploads depend on multiple PHP and web server settings, troubleshooting upload issues should include reviewing max_input_time alongside upload_max_filesize, post_max_size, max_execution_time, and the web server's own request limits.

Explore More

Technology Guides →

PHP max_execution_time Explained: Configuration, Timeouts, and Best Practices

PHP opcache.max_accelerated_files Explained: Configuration, Performance, and Best Practices

PHP opcache.validate_timestamps Explained: Configuration, Code Updates, and Best Practices

PHP opcache.revalidate_freq Explained: Configuration, Performance, and Best Practices

Southeast Asia Insights →