PHP : Fix Call to undefined function curl_init() error
Problem:
Some PHP libraries or packages depend on your server having curl
program installed. Missing curl
or the PHP to curl bridge can cause problem during development or deployment phase.
For example, you are developing your PHP program and you encounter the following error message during test phase:
An uncaught Exception was encountered
Type: Error
Message: Call to undefined function curl_init()
How to fix this problem?
Solution:
The server is missing php-curl
or php7-curl
package. Install them by
For Cent OS:
sudo yum install php5-curl
or sudo yum install php7-curl
and
sudo yum install curl
For Ubuntu:
sudo apt-get install php5-curl
or sudo apt-get install php7-curl
and
sudo apt-get install curl
See also : Fix "Failed to start php5-fpm.service: Unit php5-fpm.service is masked."
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+7.4k Golang : How to iterate a slice without using for loop?
+18.6k Golang : Example for RSA package functions
+8.8k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+15.6k Golang : Find location by IP address and display with Google Map
+11.6k Golang : Change date format to yyyy-mm-dd
+11.4k Golang : How to use if, eq and print properly in html template
+17.8k Golang : Read data from config file and assign to variables
+15.4k Golang : Get HTTP protocol version example
+15.4k Golang : How to check if IP address is in range
+12.8k Golang : Pass database connection to function called from another package and HTTP Handler
+12.4k Golang : How to display image file or expose CSS, JS files from localhost?
+20k Golang : How to get time from unix nano example