How to enable curl in xampp?

How to enable curl in xampp?

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

Stefan Bogdanescu

Founder & Senior Architect

Enabling cURL in XAMPP: A Practical Guide

If your PHP application relies on cURL to communicate with external APIs, you will encounter immediate failures if the extension isn't loaded. This is a common scenario when deploying projects built on the LAMP stack or local development environments like XAMPP. The core issue isn't that cURL doesn't exist in XAMPP; it's that the PHP configuration has disabled the module by default to reduce memory footprint and attack surface. Enabling it requires modifying the php.ini file, but the specifics depend on whether you are using a dedicated installation of Apache or the bundled version included with XAMPP.

Locating the Configuration File

The first step is identifying which php.ini file your server is actually reading. In a standard XAMPP setup, this file usually resides in the xampp/php/ directory. However, XAMPP often includes multiple copies of php.ini to simplify upgrades or provide different configurations for different modules. You should not simply edit every file you find; instead, look for the one with the highest priority.

To verify which file is active, add the following line to the top of your main php.ini:

display_errors = On
error_reporting = E_ALL
log_errors = On
php_flag display_startup_errors = 1
php_flag display_errors = On

Then restart Apache and check for any "Loaded Modules" output or use a simple script to call phpinfo(). If the curl section is missing, you know you need to enable it.

Method 1: Modifying php.ini Directly

The most straightforward approach is to uncomment the existing line in your active php.ini. Search for the following block:

;extension=curl

Remove the semicolon (;) at the beginning of the line so it reads:

extension=curl

After saving the file, you must restart the Apache service. In XAMPP Control Panel, click Stop next to Apache, wait a moment for the port to release (usually 80), and then click Start.

Method 2: Using php.ini-dist or php.ini-production

Some versions of XAMPP ship with separate configuration files named php.ini-dist and php.ini-production. These are often copies of the main config file used for reference. If you copied php.ini-dist to your main php.ini, ensure that the extension=curl line is uncommented in the main file, not the copy. The server ignores commented-out lines regardless of whether they exist in backup files.

Verifying the Installation

Once Apache restarts, verify that cURL is active. Create a new PHP file named info.php containing:

<?php
echo "cURL Version: " . curl_version()['version'] . "\n";
echo "cURL enabled: " . (extension_loaded('curl') ? 'Yes' : 'No');
?>

Access this file via your browser. If you see the version string and "Yes", the module is loaded. If you see "No" or a warning about missing modules, check for typos in the filename (e.g., curl vs curl.so) or ensure that the directory permissions allow Apache to load shared libraries.

Important Considerations for Development vs. Production

Enabling cURL on a local XAMPP environment is safe because it operates behind your firewall. However, you should never deploy an unpatched XAMPP installation to production. The bundled PHP and OpenSSL versions in XAMPP often lag behind the latest releases, which can lead to compatibility issues with modern APIs that require TLS 1.3 or specific cipher suites.

For production applications built on Laravel, it is highly recommended to switch from XAMPP to a dedicated PHP runtime (PHP-FPM) paired with Nginx or Apache. You can read more about building robust PHP environments at https://laravelcompany.com. This approach ensures you are using the latest security patches and performance optimizations, rather than relying on legacy bundled distributions.

Troubleshooting Common Errors

If enabling cURL results in a "Call to undefined function curl_init()" error even after restarting Apache, check your system's OpenSSL version. cURL depends on the underlying SSL library. On Windows, XAMPP bundles its own OpenSSL, but if you have manually installed an older version of OpenSSL or conflicting DLLs in the C:\Windows\System32 folder, it may break the connection.

Another frequent issue occurs when using Composer to install packages that require cURL. If the extension is missing, Composer will fail to resolve dependencies correctly. Always ensure the extension=curl line is uncommented before running composer update.

Finally, remember that enabling cURL increases your PHP memory usage slightly. While negligible for most projects, high-traffic applications might need to monitor their memory limits more closely once additional extensions are loaded.

Our network