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
How to Check If a Date Is in a Given Range
Are PHP Include Paths Relative to the File or the Calling Code
Sorting a PHP Array of Arrays by Custom Order
Pdo Binding Values For MySQL in Statement
File_Get_Contents() Breaks Up Utf-8 Characters
Can Png Image Transparency Be Preserved When Using PHP'S Gdlib Imagecopyresampled
How to Check Uploaded File Type in PHP
How Does True/False Work in PHP
I Have an Array of Integers, How to Use Each One in a MySQL Query (In PHP)
PHP: Producing Relative Date/Time from Timestamps
Laravel: Error [Pdoexception]: Could Not Find Driver in Postgresql
PHP: How to Get All Possible Combinations of 1D Array
Insert Blobs in MySQL Databases With PHP
Achieve Hierarchy, Parent/Child Relationship in an Effective and Easy Way