XAMPP how to increase upload_max_filesize

XAMPP how to increase upload_max_filesize

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

Stefan Bogdanescu

Founder & Senior Architect

XAMPP How to Increase upload_max_filesize

When moving from a standard Apache installation to XAMPP on Windows, you quickly discover that configuration precedence changes in ways that frustrate even seasoned engineers. The specific scenario of failing to import an 11MB SQL file via phpMyAdmin is a classic symptom of misaligned PHP directives. In your previous setup, adding php_value upload_max_filesize 20M to the .htaccess file solved the issue immediately because Apache successfully loaded that configuration before PHP initialized.

In XAMPP, however, this approach often fails silently. The core problem lies in how the XAMPP distribution manages its directory structure. Unlike a vanilla Apache install where you typically have full control over your document root and can place .htaccess files freely, XAMPP ships with Apache preconfigured to ignore .htaccess files by default for security reasons. This means that any php_value directives you add to an .htaccess file located in the public folder or the htdocs directory are completely discarded. The server simply skips them and falls back to the values defined elsewhere.

To resolve this, you must identify which configuration file Apache is actually using to initialize PHP settings. In a standard Linux environment, you might edit php.ini directly in the web root, but on Windows with XAMPP, the active configuration is almost always located at C:\xampp\php\php.ini. This single file acts as the source of truth for all PHP runtime behavior unless explicitly overridden by a loaded .htaccess (which requires AllowOverride All enabled in the Apache config).

If you modify php.ini directly, be prepared for the "dark magic" effect where changes seem to vanish after a restart. This usually happens because XAMPP bundles multiple versions of PHP (e.g., PHP 8.x and older 7.x) or because the environment variable APP_ENV triggers different config files if you are using Laravel's built-in server or specific XAMPP modules. To ensure your changes persist, locate the exact line in C:\xampp\php\php.ini that reads:

upload_max_filesize = 2M

Change this value to match your requirements, such as 20M or higher depending on the SQL file size. You must also adjust post_max_size. It is a critical architectural constraint in PHP that post_max_size must always be greater than or equal to upload_max_filesize. If you set upload_max_filesize to 20M but leave post_max_size at the default (usually 8M), any form submission exceeding 8M will be truncated immediately, regardless of the upload limit. Therefore, update both directives:

upload_max_filesize = 20M
post_max_size = 20M
max_execution_time = 200
max_input_time = 200

After editing the file, you cannot simply reload Apache; you must stop and restart the entire XAMPP stack to ensure the new php.ini is parsed correctly. If you are using a custom .htaccess file in your project root as an alternative method, you must first edit the httpd.conf file located at C:\xampp\apache\conf\httpd.conf. Search for the line AllowOverride None and change it to AllowOverride All. This permission flag tells Apache to process .htaccess files in subdirectories. Once this is done, place your .htaccess with the php_value directives inside your project folder.

However, relying on .htaccess for complex file size limits is generally discouraged in production environments because it adds a layer of indirection and potential confusion regarding which configuration takes precedence. Editing php.ini directly remains the most robust solution for XAMPP. If you are building a Laravel application on this stack, remember that while upload_max_filesize handles the raw upload limit, your application's config/filesystems.php might also define disk limits or cache behaviors that need alignment with these system settings to prevent unexpected failures during large file imports.

Our network