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
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
Nginx:
sudo systemctl restart nginx
Verifying Installation
Use phpinfo() to confirm that cURL is installed and enabled:
<?php phpinfo(); ?>
If cURL is installed correctly, you should see the "cURL" section in the output.
Additional Information
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!