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
+8.3k Facebook : Getting the friends list with PHP return JSON format
+5.8k Golang : Pat multiplexer routing example
+7.4k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+24.1k Golang : How to read integer value from standard input ?
+10.9k Golang : Add ASCII art to command line application launching process
+11.3k Golang : Get absolute path to binary for os.Exec function with exec.LookPath
+6.8k Golang : get the current working directory of a running program
+8.8k Golang : Convert octal value to string to deal with leading zero problem
+18.9k Golang : How to force compile or remove object files first before rebuild?
+12.4k Golang : Check if an integer is negative or positive
+61.3k Golang : Convert HTTP Response body to string
+32.8k Golang : Integer is between a range