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:
- Open the XAMPP control panel.
- Open the PHP (
php.ini) configuration file. On Windows, this file is typically located atC:\xampp\php\php.ini. - Search for the following line in the file:
;extension=curl- Remove the
;character from the beginning of the line to uncomment it. The line should now look like this:
extension=curl- Save the
php.inifile and close it. - 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.
- 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.