PHP Fatal error: Uncaught Error: Call to undefined function curl_init()

Last updated on

cURL is a PHP extension used to transfer data to or from a remote server. If the extension is not installed on your web server, you may get a fatal PHP error about an undefined function curl_init().

Shared Hosting

If you are on shared hosting and do not have command line access to your web server, you may have to contact your web host to see if they support the cURL PHP extension. Many web hosts disable this extension by default for security reasons but may enable it manually for you on request.

Apache and Nginx on Linux

If you have shell access to your Apache or Nginx web server, you must install the cURL extension:

sudo apt-get install php-curl

You must also restart your web server for changes to take effect.

To restart Apache, run:

sudo service apache2 restart

To restart Nginx, run:

sudo service nginx restart

Windows

If you’re on Windows, go to your php.ini file and search for “curl”.

Remove the ; semicolon from the beginning of the following line.

php.ini
;extension=curl

If you are on an older version of PHP, the line might look like below.

php.ini
;extension=php_curl.dll

After you have saved the file you must restart your HTTP server software before this can take effect.

Let me know in the comments if this helped. Follow me on Twitter, Facebook and YouTube.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

1 Star2 Stars3 Stars4 Stars5 Stars 3.43 (7 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces