-1

I have a wordpress plugin that is trying to use curl but giving me the following error.

PHP Fatal error: Uncaught Error: Call to undefined function curl_init()

$curl = curl_init();

I have the same issue on my local dev environment and in my staging environment.

http://topmortgagepro.com/whats-your-home-worth/ At the time of posting it will include the phpinfo() That will be removed if you see this at a later time. htaccess user/password is pixona:pixona to see the site.

I have tried many solutions offered with no luck. Open to ideas and can show other config settings as needed.

I have tried the following and restarted apache after each (on local machine):

apt-get install php-curl
apt-get install php7.0-curl

edited the php.ini to uncomment the following:

extension=php_curl.dll
extension=php_bz2.dll

added this extension in the php.ini

extension=php_curl.so

phpenmod curl
PhxSteve
  • 103
  • 1
  • 13
  • 1
    Possible duplicate of [curl\_init() function not working](http://stackoverflow.com/questions/4477535/curl-init-function-not-working) – AmericanUmlaut Feb 24 '17 at 21:08
  • You should always at the very least google your error messages before making a new question - if you had, you would see that there are already SO questions addressing this exact issue. – AmericanUmlaut Feb 24 '17 at 21:08
  • I understand it is a duplicate. As I have not posted much, what is the protocol if the solutions given in those answers do not work. I have gone through at least 30 of them. Most with the same solutions that do not work. Not critical of your point, but open to suggestions to keep this platform concise yet possibly address issues outside other questions. – PhxSteve Feb 24 '17 at 21:23
  • You need to expand your answer to explain all the things that you have done. Show how you went about installing CURL, for example, since it seems likely that something has gone wrong there. – AmericanUmlaut Feb 24 '17 at 21:25
  • Start with a fresh installation of Ubuntu, execute `sudo apt-get install php-curl`. Show us the output of the apt-get, if this does not work. – NineBerry Feb 24 '17 at 22:24

1 Answers1

3

The solution came down to the distribution being out of date. To diagnose the issue I made a sample script to see if curl was loading.

<?php
    if (!extension_loaded('curl')) {
        echo 'failed';
    } else {
        echo 'loaded';
    }
?>

This gave me the following error:

PHP Warning: PHP Startup: Unable to load dynamic library       '/usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so: undefined symbol: zend_unset_property in Unknown on line 0

With that I came across this other question which suggested doing

apt-get dist-upgrade

PHP Startup: Unable to load dynamic library `curl.so` Ubuntu

After the upgrade (I used the new php.ini) the script worked perfectly.

Community
  • 1
  • 1
PhxSteve
  • 103
  • 1
  • 13