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
+41k Golang : Get hardware information such as disk, memory and CPU usage
+9.1k Golang : Embed secret text string into binary(executable) file
+7.4k Golang: Prevent over writing file with md5 hash
+7.9k Golang : automatically figure out array length(size) with three dots
+19.6k Golang : Clean up null characters from input data
+8.9k Golang : Get current, epoch time and display by year, month and day
+29.3k Golang : Interpolating or substituting variables in string examples
+4.2k Golang : Calculate half life decay example
+10.6k Golang : Get remaining text such as id or filename after last segment in URL path
+11.3k Golang : Arithmetic operation with numerical slices or arrays example
+10.8k Golang : Perform sanity checks on filename example