Skip to main content

How to Enable cURL in PHP?

cURL is a popular PHP library that provides functions for applications to transfer data over a variety of protocols, including HTTP, HTTPS, FTP, and more. It can be used to fetch resources from a server, submit data to a server, or both. cURL is easy to use and well-documented.

To use cURL, you must have the curl.so file installed somewhere on your server. When you see the error message “Fatal error: Call to undefined function curl_init(),” it means that the server you’re working on doesn’t have cURL enabled. In order to use the curl_init() function (or any other cURL functions), cURL must be enabled on the server.

Steps to enable cURL:

  • Open php.ini with a text editor. The file can be a located in different folder depending on your server’s OS or software. For example, C:\xampp\php\php.ini for XAMPP or /etc/php/7.2/apache2/php.ini for Debian Apache.
  • Jump to ;extension=curl line and emove the ; character.
  • Restarting Apache/nginx server to make the change take effect.

By continuing to use the site, you agree to the use of cookies.