This is due to missing PHP Extention named php-curl on the PHP Version which your website is using.

 

In this guide we will  fix “undefined function curl_init()” by installing phpXX-php-curl (XX here is PHP version) via WHM.

 

  1. Login to WHM and open the main page of WHM where it shows various Sections
  2. Locate or Search “Software” Section and Open it
  3. Open “EasyApache 4” (or EasyApache 3 if you are still using it)
  4. Tap on Customize for Current Installed Packages ( With EA3, it can be a bit different but a similar option will be present)
  5. After current package opens navigate to “PHP Extensions” menu in the left pane.
  6. In the search bar, you have to search for curl and select to install.
  7. Make sure you filter the PHP version you are using and need for particular PHP Version (In case you want to install for every user, then you can select all the PHP versions)
  8. Tick on Install option.
  9. Now move to “Review” Section on Left Pane and long list opens.
  10. Under Green box, it will show that our php-curl will be installed under the current profile and we tap on Save Provision Option below the list.
  11. The installation progress starts and finishes successfully.
  12. Verify the extension by repeating Steps #2 to #6 and it should show a blue dot and installed box right next to it.

So, with this, we have finished installing php-curl which will eventually fix “undefined function curl_init()” error for users on that server. Using the same method we can Install and uninstall other PHP Extensions.

 

For LAMP setup users with PHP 7.0, a simple command will install the required missing extension :

 

sudo apt install php7.0-curl

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)