How to change max_input_vars

How to change max_input_vars

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

How to change max_input_vars

The warning Unknown: Input variables exceeded 1000 appears because PHP enforces a hard limit on the number of POST or GET variables it will accept in a single request. By default, this limit is set to 1000. When your form contains more fields than this threshold, PHP stops processing the input entirely and throws an exception before your application logic ever runs.

You attempted to resolve this by modifying the php.ini file directly, which is the correct approach for a permanent fix. However, you noticed that changing the value in php.ini did not take effect on your XAMPP localhost environment running PHP 5.5.15. This discrepancy usually stems from how PHP determines its configuration hierarchy and whether it is actually reading the file you edited.

Understanding the Configuration Hierarchy

PHP does not always look at every php.ini file present in the system. It follows a specific priority order when determining which settings to apply:

  1. Compile-time (Hard-coded) defaults: These are used if no configuration files are found or if they are ignored.
  2. Environment variables: Settings defined in the OS environment take precedence over php.ini.
  3. php.ini file: The main configuration file.
  4. Per-directory .htaccess: Apache-specific overrides.
  5. Per-virtual-host configuration.

If a value is set in an earlier step, PHP ignores any changes made in later steps. In the context of XAMPP on Windows, the issue often arises because the web server runs as a separate service or pool that might be using a different php.ini than the one you edited for your CLI tools.

Verifying Which File is Active

Before assuming your edit failed, you must confirm which configuration file PHP is actually using. Create a new file named info.php in your XAMPP htdocs folder with the following content:

<?php
phpinfo();
?>

Access this file via your browser (e.g., http://localhost/info.php). Scroll down to the section labeled "Configuration File" or search for "Loaded Configuration File". This will tell you the exact path of the .ini file currently loaded.

If the path listed matches the one you edited, the change should apply immediately without restarting XAMPP. If the paths do not match, you have likely edited a file that is not being read by the Apache service running within XAMPP. In some XAMPP installations, there are multiple php.ini files (e.g., php5.5.ini, php.ini-development, php.ini-production). Ensure you are editing the specific version corresponding to your PHP 5.5 installation.

The Restart Requirement

Even when the correct file is identified, PHP caches its configuration at startup. Editing a file while the server is running will not update the active settings. You must restart the Apache service for the new max_input_vars value to take effect. In XAMPP, this is done via the Control Panel: click Apache -> Service -> Restart.

Environment Variables Override

A common pitfall on Windows is that environment variables can override php.ini. Check your system's environment variables for a key named PHP_MAX_INPUT_VARS. If this exists and contains a value lower than your new setting in php.ini, it will win. Remove or modify this environment variable to ensure the php.ini setting takes precedence.

Security and Memory Trade-offs

Increasing max_input_vars solves the immediate error but introduces trade-offs you need to consider. Raising this limit significantly increases the memory required for every request that submits data, as PHP must store each variable in memory. If your form is large, ensure your memory_limit setting in php.ini is also increased accordingly (e.g., to 256M or higher).

Additionally, be aware that extremely high limits can be exploited if your application does not validate input sizes. An attacker could craft a request with thousands of small keys to exhaust server memory, leading to a denial-of-service condition. If you are using Laravel or another framework, ensure your middleware and validation logic still enforce strict constraints on individual field sizes even after raising the global limit.

For production environments serving high traffic, relying solely on php.ini changes can be fragile if multiple processes share the same config file. In containerized environments or complex stacks, you might need to adjust settings via docker-compose.yml or specific Apache virtual host configurations to ensure consistency across all nodes.

Our network