[英]Uncaught Error: Call to undefined function curl_init()
I have a wordpress plugin that is trying to use curl but giving me the following error. 我有一个试图使用curl的wordpress插件,但给了我以下错误。
PHP Fatal error: Uncaught Error: Call to undefined function curl_init() PHP致命错误:未捕获错误:调用未定义函数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. http://topmortgagepro.com/whats-your-home-worth/在发布时,它将包含phpinfo(),如果您以后再看到它,它将被删除。 htaccess user/password is pixona:pixona to see the site.
htaccess用户/密码是pixona:pixona以查看站点。
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): 我尝试了以下操作,并在每个(在本地计算机上)重新启动apache之后:
apt-get install php-curl
apt-get install php7.0-curl
edited the php.ini to uncomment the following: 编辑了php.ini以取消注释以下内容:
extension=php_curl.dll
extension=php_bz2.dll
added this extension in the php.ini 在php.ini中添加了此扩展名
extension=php_curl.so
phpenmod curl
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.
为了诊断问题,我制作了一个示例脚本来查看是否正在加载curl。
<?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 PHP启动:无法加载动态库`curl.so` Ubuntu
After the upgrade (I used the new php.ini) the script worked perfectly. 升级后(我使用了新的php.ini),脚本运行良好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.