douzheng5717 2017-02-24 21:02
浏览 42
已采纳

未捕获的错误:调用未定义的函数curl_init()

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
  • 写回答

1条回答 默认 最新

  • doumao8803 2017-02-25 05:28
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了