将 PHP 7 安装到我的服务器后,PHP 模块不加载
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37008860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP modules don't load after installing PHP 7 to my server
提问by Rick Sanchez
I installed PHP 7 to my server (as a result, I have not /etc/php5 and /etc/php/7.0). When I run my web app, I cant see any of my previous CURL (or fork).
我在我的服务器上安装了 PHP 7(因此,我没有 /etc/php5 和 /etc/php/7.0)。当我运行我的网络应用程序时,我看不到我以前的任何 CURL(或 fork)。
at first I got this err msg:
起初我收到了这个错误消息:
Message: Call to undefined function curl_init()
消息:调用未定义的函数 curl_init()
and after installing php7-curl i get it enabled - approved on info() function and this test code:
安装 php7-curl 后,我启用了它 - 在 info() 函数和此测试代码上获得批准:
var_dump(_isCurl());
function _isCurl(){
return function_exists('curl_version');
}
returning TRUE.
返回 TRUE。
but when having an actual CURL in my code I get this error:
但是当我的代码中有一个实际的 CURL 时,我收到了这个错误:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 警告:PHP 启动:无法加载动态库 '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll:无法打开共享对象文件:没有这样的文件或目录在未知的第 0 行
in /usr/lib/php/20151012/
i have only .so
files which doesn't make sense. (same goes for the /usr/lib/php5/20131226
folder). So what is it trying to get and why from there?
在/usr/lib/php/20151012/
我只有.so
没有意义的文件。(/usr/lib/php5/20131226
文件夹也是如此)。那么它想得到什么,为什么要从那里得到呢?
how can I configure my new php.ini file to get the previous model settings? (if possible with the enabled PCNTL_FORK too) How can I make it work with curl? what the hell happened???
如何配置我的新 php.ini 文件以获取以前的模型设置?(如果启用 PCNTL_FORK 也可能的话)我怎样才能让它与 curl 一起工作?到底发生了什么???
EDIT 04.05.2016:
2016 年 5 月 4 日编辑:
Ok, i decided to change it to curl.so
and now got this msg PHP Warning: Module 'curl' already loaded in Unknown on line 0
and then I disabled it, and somehow, curl now is working (commented curl ;extension:curl.so
and ;extension:php_curl.dll
.
What the hell.
好的,我决定将其更改为curl.so
现在收到此 msgPHP Warning: Module 'curl' already loaded in Unknown on line 0
然后我禁用了它,不知何故,curl 现在正在工作(评论 curl;extension:curl.so
和;extension:php_curl.dll
。到底是什么。
回答by className
I had this exact problem.
我有这个确切的问题。
I have just spent the last few hours trying to fix some stuff and in my haste I for some reason enabled this line:
我刚刚花了最后几个小时试图修复一些东西,出于某种原因,我匆忙启用了这条线:
extension:php_curl.dll
Obviously, that makes 0 sense, as someone said but the error message is weird after you do that. Running apt-get dist-upgrade
DID NOT solve the problem.
显然,这是 0 的意义,正如有人所说,但在你这样做之后错误信息很奇怪。运行并apt-get dist-upgrade
没有解决问题。
So, after pulling out some more hair and re-reading this post a 100 times, I just commented it back out
所以,在拔出更多头发并重新阅读这篇文章 100 次之后,我只是将其评论了出来
;extension:php_curl.dll
and ya, problem solved.
是的,问题解决了。
So the OP must have done what I did... drink beer while working
所以 OP 一定做了我所做的......工作时喝啤酒
回答by Rick Sanchez
running apt-get dist-upgrade
fixed all the problems :)
运行apt-get dist-upgrade
解决了所有问题:)
回答by Remy Mellet
On my case, to get curl working :
就我而言,要使 curl 工作:
- sudo apt-get install php-curl
- comment curl extension :
;extension=php_curl.dll
in php.ini (eg /etc/php/7.1/cli/php.ini)
- 须藤 apt-get 安装 php-curl
- 注释 curl 扩展名:
;extension=php_curl.dll
在 php.ini 中(例如 /etc/php/7.1/cli/php.ini)