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
+13.1k Swift : Convert (cast) Int to String ?
+12k Golang : How to parse plain email text and process email header?
+9.5k Facebook : Getting the friends list with PHP return JSON format
+5.6k Clean up Visual Studio For Mac installation failed disk full problem
+4.8k Chrome : How to block socketloop.com links in Google SERP?
+22.2k Golang : Repeat a character by multiple of x factor
+24.8k Golang : How to print rune, unicode, utf-8 and non-ASCII CJK(Chinese/Japanese/Korean) characters?
+12k Golang : Convert decimal number(integer) to IPv4 address
+6.3k Apt-get to install and uninstall Golang
+28.3k Golang : Connect to database (MySQL/MariaDB) server
+18.9k Golang : Delete duplicate items from a slice/array
+11.4k Golang : How to flush a channel before the end of program?