本文介绍了PHP 启动:无法在 Ubuntu 中加载动态库“openssl"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到问题标题中的错误消息,或者确切地说我收到了这条消息

I get the error message in the question's title, or to be exact I get this message

  PHP Startup: Unable to load dynamic library 'openssl'
  (tried: /usr/lib/php/20170718/openssl (/usr/lib/php/20170718/openssl:
  cannot open shared object file: No such file or directory),
  /usr/lib/php/20170718/openssl.so (/usr/lib/php/20170718/openssl.so: cannot
  open shared object file: No such file or directory)) in Unknown

我真正的问题是它只是有时而不是总是发生.在一秒钟内,请求有效,而在另一秒钟内,我在同一请求中收到此消息的 500 内部错误.

My real issue with this is that it only occurs sometimes and not always. In one second a request works and in the other, I get a 500 internal error with this message on the same request.

这在我启用 apache proxyproxy_wstunnel 模组后开始发生,但也可能是 apt-get upgrade>apt-get 更新.

This started to occur after I enabled the apache proxy and proxy_wstunnel mods but could also have been an apt-get upgrade or apt-get update.

来自 phpinfo();:

  • 版本:PHP 版本 7.2.4-1+ubuntu16.04.1+deb.sury.org+1
  • 已启用 OpenSSL 支持
  • OpenSSL 库版本 OpenSSL 1.1.0h 2018 年 3 月 27 日
  • OpenSSL 标头版本 OpenSSL 1.1.0h 2018 年 3 月 27 日
  • Openssl 默认配置/usr/lib/ssl/openssl.cnf

如果您需要更多信息,请随时完成任务.

If you need futher information feel free to task.

来自 apache error.log

PHP 警告:PHP 启动:无法加载动态库 'openssl'(尝试:/usr/lib/php/20170718/openssl(/usr/lib/php/20170718/openssl:无法打开共享对象文件:没有这样的)文件或目录),/usr/lib/php/20170718/openssl.so (/usr/lib/php/20170718/openssl.so: 无法打开共享对象文件: 没有这样的文件或目录)) 在 Unknown on line 0

[Fri Apr 20 06:25:01.973125 2018] [mpm_prefork:notice] [pid 2872] AH00163: Apache/2.4.18 (Ubuntu) 配置——恢复正常操作

[Fri Apr 20 06:25:01.973125 2018] [mpm_prefork:notice] [pid 2872] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations

[Fri Apr 20 06:25:01.973154 2018] [core:notice] [pid 2872] AH00094:命令行:'/usr/sbin/apache2'

[Fri Apr 20 06:25:01.973154 2018] [core:notice] [pid 2872] AH00094: Command line: '/usr/sbin/apache2'

[Fri Apr 20 06:34:04.715749 2018] [php7:error] [pid 3490] [client 5.146.199.236:41654] PHP 致命错误:未捕获的 yii\web\HeadersAlreadySentException:已发送 invar/www/html_back/vendor/yiisoft/yii2/web/Response.php 在第 414 行.在/var/www/html_back/vendor/yiisoft/yii2/web/Response.php:366\n堆栈跟踪:\n#0/var/www/html_back/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()\n#1/var/www/html_back/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()\n#2/var/www/html_back/vendor/yiisoft/yii2/base/ErrorHandler.php(262): yii\web\ErrorHandler->;renderException(Object(yii\base\ErrorException))\n#3 [内部函数]: yii\base\ErrorHandler->handleFatalError()\n#4 {main}\n 抛出在/var/www/html_back/vendor/yiisoft/yii2/web/Response.php 在线 366

[Fri Apr 20 06:34:04.715749 2018] [php7:error] [pid 3490] [client 5.146.199.236:41654] PHP Fatal error: Uncaught yii\web\HeadersAlreadySentException: Headers already sent in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 414. in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php:366\nStack trace:\n#0 /var/www/html_back/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()\n#1 /var/www/html_back/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()\n#2 /var/www/html_back/vendor/yiisoft/yii2/base/ErrorHandler.php(262): yii\web\ErrorHandler->renderException(Object(yii\base\ErrorException))\n#3 [internal function]: yii\base\ErrorHandler->handleFatalError()\n#4 {main}\n thrown in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 366

[Fri Apr 20 06:34:58.208208 2018] [php7:error] [pid 3486] [client 5.146.199.236:41681] PHP 致命错误:未捕获的 yii\web\HeadersAlreadySentException:已发送 invar/www/html_back/vendor/yiisoft/yii2/web/Response.php 在第 414 行.在/var/www/html_back/vendor/yiisoft/yii2/web/Response.php:366\n堆栈跟踪:\n#0/var/www/html_back/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()\n#1/var/www/html_back/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()\n#2/var/www/html_back/vendor/yiisoft/yii2/base/ErrorHandler.php(262): yii\web\ErrorHandler->;renderException(Object(yii\base\ErrorException))\n#3 [内部函数]: yii\base\ErrorHandler->handleFatalError()\n#4 {main}\n 抛出在/var/www/html_back/vendor/yiisoft/yii2/web/Response.php 在线 366

[Fri Apr 20 06:34:58.208208 2018] [php7:error] [pid 3486] [client 5.146.199.236:41681] PHP Fatal error: Uncaught yii\web\HeadersAlreadySentException: Headers already sent in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 414. in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php:366\nStack trace:\n#0 /var/www/html_back/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()\n#1 /var/www/html_back/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()\n#2 /var/www/html_back/vendor/yiisoft/yii2/base/ErrorHandler.php(262): yii\web\ErrorHandler->renderException(Object(yii\base\ErrorException))\n#3 [internal function]: yii\base\ErrorHandler->handleFatalError()\n#4 {main}\n thrown in /var/www/html_back/vendor/yiisoft/yii2/web/Response.php on line 366

推荐答案

我遇到了同样的问题.

似乎是我手动启用创建的

It seems like i created it by manually enable

extension=openssl

在 php.ini 中.再次禁用后一切正常

in the php.ini. After disable it again everything looked fine

php -i | grep -i openssl
SSL Version => OpenSSL/1.1.0g
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.0g  2 Nov 2017
OpenSSL Header Version => OpenSSL 1.1.0g  2 Nov 2017
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled

这篇关于PHP 启动:无法在 Ubuntu 中加载动态库“openssl"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 14:50