Call to undefined function curl_init() even it is enabled in php7
The error message "Call to undefined function curl_init()" typically indicates that the cURL extension for PHP is not installed or is not enabled.
The error message "Call to undefined function curl_init()" typically indicates that the cURL extension for PHP is not installed or is not enabled. To resolve this issue, you should check to see if the cURL extension is installed on your server. If it is not installed, you can install it using the package manager for your operating system. If it is installed, you should check to see if it is enabled in your PHP configuration. This can typically be done by checking the output of the phpinfo() function or by looking for the extension in your php.ini file and ensuring that it is not commented out.
Installation Commands
- Ubuntu/Debian:
sudo apt install php-curl - RHEL/CentOS/Fedora:
sudo yum install php-curlorsudo dnf install php-curl
Enable in php.ini
Ensure the following line is present and uncommented in your php.ini file:
extension=curlRestart Services
After modifying php.ini, restart your web server or PHP-FPM to apply changes:
sudo systemctl restart apache2
# or
sudo systemctl restart php-fpmVerification Run a minimal PHP script to confirm the extension is loaded:
<?php echo function_exists('curl_init') ? 'cURL is enabled' : 'cURL is disabled'; ?>