PHP max_input_vars Explained: Configuration, Limits, and Best Practices

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

Introduction

The max_input_vars directive defines the maximum number of input variables that PHP accepts in a single request. These input variables include values submitted through HTML forms using the $_GET, $_POST, and $_COOKIE superglobals.

When a request contains more variables than the configured limit, PHP silently discards the remaining variables. This may result in incomplete form submissions, missing configuration values, or unexpected application behavior.

This guide explains how max_input_vars works, how to configure it, recommended values for different applications, and common issues caused by reaching the input variable limit.

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_vars?

The max_input_vars directive limits the number of input variables that PHP processes in a single request.

Example:

max_input_vars = 1000

This means PHP processes up to 1,000 input variables.

Any variables beyond this limit are ignored.

How max_input_vars Works

Suppose a user submits a large HTML form.

Browser
    │
    ▼
HTML Form
    │
    ├── Field 1
    ├── Field 2
    ├── Field 3
    ├── ...
    ├── Field 1000
    ├── Field 1001
    └── Field 1002
          │
          ▼
PHP
          │
Processes first 1000 variables
Ignores the remaining variables

As a result, some submitted values never reach the PHP application.

Check the Current Value

Run:

php -i | grep max_input_vars

Example output:

max_input_vars => 1000 => 1000

Locate the Active php.ini File

php --ini

Example:

Loaded Configuration File: /etc/php.ini

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

Change max_input_vars

Open the PHP configuration file.

sudo nano /etc/php.ini

Locate:

max_input_vars = 1000

Increase the value if necessary.

Example:

max_input_vars = 3000

Save the file.

Restart PHP-FPM

Apply the new configuration.

sudo systemctl restart php-fpm

Verify the service status.

sudo systemctl status php-fpm

Expected output:

Active: active (running)

Verify the Configuration

Run:

php -i | grep max_input_vars

Or use:

<?php
phpinfo();

Search for:

max_input_vars

The displayed value should match the updated configuration.

Recommended Values

| Application            | Recommended Value |
| ---------------------- | ----------------- |
| Small websites         |              1000 |
| WordPress              |              3000 |
| WooCommerce            |              5000 |
| Elementor              |         3000–5000 |
| Large enterprise forms |        5000–10000 |

Only increase the limit when your application genuinely requires a larger number of form fields.

Common Warning

PHP may log a warning similar to:

PHP Warning:

Input variables exceeded 1000.

To increase the limit change max_input_vars in php.ini.

Although the application may continue running, some submitted values will be missing.

Common Issues

WordPress Menus Are Not Saved

Large navigation menus can exceed the default limit of 1000 variables.

Increasing max_input_vars usually resolves the issue.

Missing Form Data

If some form fields disappear after submission, check whether the total number of submitted variables exceeds the configured limit.

WooCommerce Product Attributes Missing

Stores with many product variations and attributes can easily exceed the default limit, resulting in incomplete product data being saved.

max_input_vars vs Other PHP Limits

Each directive controls a different aspect of request processing.

Browser
    │
    ▼
PHP
    │
    ├── post_max_size
    ├── upload_max_filesize
    ├── memory_limit
    ├── max_execution_time
    └── max_input_vars
    │
    ▼
Application

Increasing post_max_size or memory_limit does not increase the number of input variables PHP accepts.

Best Practices

Keep the default value if your application works correctly.

Increase the limit only for applications with large forms.

Restart PHP-FPM after modifying the configuration.

Verify the new value using phpinfo() or php -i.

Test complex forms after changing the configuration.

Conclusion

The max_input_vars directive limits the number of input variables PHP processes in a single request. While the default value is sufficient for many websites, applications with large forms, extensive WordPress menus, or complex WooCommerce products often require a higher limit.

When troubleshooting incomplete form submissions, checking max_input_vars is just as important as reviewing post_max_size and upload_max_filesize.

Explore More

Technology Guides →

PHP max_file_uploads Explained: Configuration, Limits, and Best Practices

PHP upload_max_filesize Explained: Configuration, Limits, and Best Practices

PHP post_max_size Explained: Configuration, Limits, and Best Practices

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

Southeast Asia Insights →