How to enable cURL in PHP / XAMPP

PhpCurlXampp

Php Problem Overview


How do I enable cURL in PHP?

​​

Php Solutions


Solution 1 - Php

On Debian with Apache 2:

apt-get install php5-curl
/etc/init.d/apache2 restart

(php4-curl if it's php4)

Solution 2 - Php

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.

Solution 3 - Php

Steps for Windows 7:

  1. Ensure that the php.ini file that the PHP engine uses is the one you think it is.
  2. Ensure extension_dir in php.ini is correctly set to the ext folder
  3. Ensure extension=php_curl.dll in the php.ini is uncommented

Finally and maybe the one most people don't know: 4. Ensure that there are these two files in the Windows System32 folder: libeay32.dll ssleay32.dll If not there, you may copy these two files from the php folder.

Solution 4 - Php

I found the file located at:

C:\xampp\php\php.ini

Uncommented:

;extension=php_curl.dll

Solution 5 - Php

For Ubuntu (and probably all Debian-Based) Linux Distributions:

sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart 

You might have seen PHP Fatal error: Call to undefined function curl_init() before.

Solution 6 - Php

In SUSE Linux:

zypper in php5-curl
rcapache2 restart

Solution 7 - Php

Solution 8 - Php

Since XAMPP went through some modifications, the file is now at xampp/php/php.ini.

Solution 9 - Php

Basic tip: After enabling the CURL in php.ini file, you need to restart the web server to make it work (my experience says).

Solution 10 - Php

PHP 7^ version:

sudo apt-get install php-curl
sudo service apache2 restart

Solution 11 - Php

Actually I did it by uncommenting extension=php_curl.dll in the xampp\apache\bin\php.ini file.

Solution 12 - Php

If you're are using MAMP, cURL is enabled by default.

Solution 13 - Php

You can check phpinfo() (create a script containing and browse to it). This will tell you if you really do have it enabled. If not, read here.

It is not recommended for the faint-hearted Windows developer.

Solution 14 - Php

For windows OS users (It worked for me) in XAMPP.

step 1: Go to C:\xampp\php\php.ini

edit this file php.ini

find curl- you will see a line ;extension=php_curl.dll.

remove semicolon (;)extension=php_curl.dll. so this line looks like

;extension=php_curl.dll

to

extension=php_curl.dll

step 2: copy ssleay32.dll, libeay32.dll from php folder. paste it in C:\Windows\System32\

step 3: Restart the system . Curl will run successfully.

Solution 15 - Php

check if curl module is available

$ ls -la /etc/php5/mods-available/
enable the curl module
$ sudo php5enmod curl

source: http://baligena.com/installing-curl-ubuntu-server/

Solution 16 - Php

Check the php version, If you installed php 7.0 version

sudo apt-get install php7.0-curl
sudo service apache2 restart

If you installed php 5.6 version

sudo apt-get install php5-curl
sudo service apache2 restart

Solution 17 - Php

If none of the above solves your problem and have installed with php-x86 (Windows 32 bit), then problem may be of openssl - for more info : https://stackoverflow.com/questions/6534505/how-to-fix-libeay32-dll-was-not-found-error

Solution 18 - Php

to install php5-curl under opensuse:

sudo yast2

->software ->software management ->search for curl ->check php5-curl case and accept.

after installation you need to restart apache server

service apache2 restart

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFeroView Question on Stackoverflow
Solution 1 - PhpPhilView Answer on Stackoverflow
Solution 2 - PhpJon BenedictoView Answer on Stackoverflow
Solution 3 - PhpWaiKit KungView Answer on Stackoverflow
Solution 4 - PhpwebDevAndEverythingElseView Answer on Stackoverflow
Solution 5 - PhpMartin ThomaView Answer on Stackoverflow
Solution 6 - PhpDavid MulderView Answer on Stackoverflow
Solution 7 - PhpchaosView Answer on Stackoverflow
Solution 8 - PhpwardprodView Answer on Stackoverflow
Solution 9 - PhpKrishnaView Answer on Stackoverflow
Solution 10 - PhpSanto BoldizarView Answer on Stackoverflow
Solution 11 - PhpFeroView Answer on Stackoverflow
Solution 12 - PhpErman TaylanView Answer on Stackoverflow
Solution 13 - PhpQuestion MarkView Answer on Stackoverflow
Solution 14 - PhpVigneswaran SView Answer on Stackoverflow
Solution 15 - PhpbaligenaView Answer on Stackoverflow
Solution 16 - PhpYana ShettyView Answer on Stackoverflow
Solution 17 - Phpuser170851View Answer on Stackoverflow
Solution 18 - Phpuser3218923View Answer on Stackoverflow