W3docs

How to enable cURL in PHP / XAMPP

To enable cURL in PHP, you need to make sure that the cURL extension is enabled in your PHP configuration.

To enable cURL in PHP / XAMPP, follow these steps:

  1. Open the XAMPP control panel.
  2. Open the PHP (php.ini) configuration file. On Windows, this file is typically located at C:\xampp\php\php.ini.
  3. Search for the following line in the file:
;extension=curl
  1. Remove the ; character from the beginning of the line to uncomment it. The line should now look like this:
extension=curl
  1. Save the php.ini file and close it.
  2. In the XAMPP control panel, click the "Stop" button next to the Apache service, and then click the "Start" button to restart the Apache server.
  3. cURL should now be enabled in your PHP installation. To test it, create a PHP file with the following code:

How to check if cURL is enabled in PHP?

<?php

if (function_exists('curl_version')) {
    echo 'cURL is installed and enabled';
} else {
    echo 'cURL is not installed or enabled';
}

Save the file and load it in your web browser. If cURL is enabled, the message "cURL is installed and enabled" should be displayed. Alternatively, you can visit http://localhost/phpinfo.php in your browser to verify that the cURL extension is listed under the loaded extensions.