Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable cURL in PHP / XAMPP

Tags:

php

curl

xampp

People also ask

Does xampp have cURL?

Thankfully, XAMPP installs the cURL library during its installation but it is not enabled by default, you have to manually enable it. However, it is easy, go to the XAMPP folder and open the php. ini file from the path ../apache/bin/php.

Does cURL work in PHP?

cURL is a PHP extension that allows you to use the URL syntax to receive and submit data. cURL makes it simple to connect between various websites and domains. Obtaining a copy of a website's material. Submission of forms automatically, authentication and cookie use.

What is cURL enabled?

cURL with respect to PHP is a library that lets us make HTTP requests in PHP. It's easier to do GET/POST requests with curl_exec to receive responses from other servers for JSON format data response and to download files. Required to “enable” cURL: The cURL, by default, is not enabled in Apache.


On Debian with Apache 2:

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

(php4-curl if it's php4)


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.


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.


I found the file located at:

C:\xampp\php\php.ini

Uncommented:

;extension=php_curl.dll

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.


In SUSE Linux:

zypper in php5-curl
rcapache2 restart