Why is the error “Call to undefined function curl_init()” appearing on your site?
If you are having trouble with the error “Call to undefined function curl_init()“, do not worry. It is usually caused by the cURL library not being installed on your system or not being enabled on your web server. cURL is a PHP extension used to transfer data to or from a remote server. Many web hosts disable this extension by default for security reasons. So, how do you deal with this issue? In today’s blog, we will give you a helpful solution to eliminate this error. Now, let’s check it out.

How to resolve the error “Call to undefined function curl_init()”
In order to address this problem, you can follow the steps below:
Step 1: Install the cURL extension
If you are using Linux, let’s use the following terminal command:
sudo apt-get install php-curl
If you are using Windows, you need to download the cURL extension from the official website.
Then, you need to restart your web server to apply your changes
To restart Apache, you can run the following command:
sudo service apache2 restart
To restart Nginx, run:
sudo service nginx restart
After restarting, you can check if cURL is working by running the command below:
curl google.com
If you see some HTML, it means that cURL is working properly.
If the error is still there after cURL has been installed, the extension may be disabled in your php.ini file. Now, you need to check the cURL extension in this file to enable cURL on your system.
Step 2: Edit php.ini file
- In Linux
Initially, you need to locate the php.ini file and edit it.
On Apache, php.ini is usually located in /etc/php/5.6/apache2/php.ini. You need to replace 5.6 with your own version. For example, php7.1, php 7.4
You need to edit:
sudo nano /etc/php/5.6/apache2/php.ini
After that, press CTRL+W and search for cURL. Then, remove the ; mark from the beginning of the following line. You need to notice that this line will be different depending on your version of PHP.
;extension=curl
To save this file and exit, press CTRL + X, press Y and then press Enter.
You must restart your web server after changing php.ini
To restart Apache, let’s run the following command:
sudo service apache2 restart
To restart Nginx, run:
sudo service nginx restart
Similarly, you also need to test with the command below:
curl google.com
If the result shows some HTML, this means that cURL is working.
- In Windows
To edit php.ini file in Windows, first go to your php.ini file and search for cURL.
Then, remove the ; mark from the beginning of the following line:
;extension=curl
If you are using an older version of PHP, this line will look like below.
;extension=php_curl.dll
Once the file is saved, you have to restart your HTTP server software. Then check if the error is gone.
Final thoughts: Call to undefined function curl_init()
Anyway, every problem will have its own solution. Hopefully, we brought you a useful solution to help you address your problem efficiently. However, if these methods cannot resolve your issue, let us know your error by leaving a comment below. We promise to support you as soon as possible. Besides, don’t forget to follow our website, since we will publish plenty of useful error-fixing blogs. Last but not least, why don’t you visit our Free WordPress Themes to get a beautiful theme as you wish?



