How to Enable Curl in PHP/Xampp

How to enable curl in xampp?

You have to modify the php.ini files in your xampp folder. Three files in three different places need to be changed.

Follow the following steps to enable curl library with XAMPP in Windows:

Step 1:

Browse and open the following 3 files

C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini

Step 2:

Uncomment the following line in your php.ini file by removing the semicolon (;).

;extension=php_curl.dll

After that it will look something like something below-

extension=php_curl.dll

Step 3:

Restart your Apache server.

Step 4:

Check your phpinfo() to see whether curl has properly enabled or not.

Enjoy using curl() library.

How to enable cURL in PHP / XAMPP

Since you're using XAMPP, uncomment the line

;extension=php_curl.dll

in xampp\apache\bin\php.ini, and then restart the Apache service.

NB: In newer XAMPP versions, PHP has moved to root xampp folder xampp\php\php.ini.

Enabling the cURL library for PHP using XAMPP for Windows

Make an

<?php phpinfo(); ?>

there you can see which php.ini is loaded. In this file you uncomment the the extension line.

When there is no php.ini in this path which is in the phpinfo this should be xampp/php/php.ini then rename one of the two files

C:\Program Files\xampp\php\php.ini-development

to

C:\Program Files\xampp\php\php.ini

CURL PHP not working on WAMP and XAMPP

After some testing I found the problem:

First I checked for erros in the script itself with:

echo curl_error($ch)

which returned this:

SSL certificate problem: unable to get local issuer certificate

Turns out I had to disable SSL certificate verification because all the websites i had tried used SSL (eg instagram, google, etc.)

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false)



Related Topics



Leave a reply



Submit