How to Fix the PHP Fatal Error: Call to undefined function curl_init()?

Susan Sarandon
Release: 2024-11-27 00:53:09
Original
196 people have browsed it

How to Fix the PHP Fatal Error: Call to undefined function curl_init()?

PHP Fatal Error: Undefined Function curl_init()

To resolve the "Call to undefined function curl_init()" error in PHP, the cURL extension must be installed and enabled.

cURL Installation and Activation

Ubuntu:

sudo apt-get install php5-curl
Copy after login

Other Systems:

Install cURL using your package manager or follow the instructions in the PHP cURL documentation (https://www.php.net/manual/en/book.curl.php).

Restart Apache

Restart your web server to load the cURL extension:

Apache:

sudo /etc/init.d/apache2 restart
Copy after login

Nginx:

sudo systemctl restart nginx
Copy after login

Verifying Installation

Use phpinfo() to confirm that cURL is installed and enabled:

<?php
phpinfo();
?>
Copy after login

If cURL is installed correctly, you should see the "cURL" section in the output.

Additional Information

  • If you continue to encounter issues, check the PHP configuration file (php.ini) to ensure that the cURL extension is uncommented.
  • You can also try using the curl_version() function to verify the cURL version installed on your system.

The above is the detailed content of How to Fix the PHP Fatal Error: Call to undefined function curl_init()?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template