'PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu
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
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.
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
.
From phpinfo();
:
- Version: PHP Version 7.2.4-1+ubuntu16.04.1+deb.sury.org+1
- OpenSSL support enabled
- OpenSSL Library Version OpenSSL 1.1.0h 27 Mar 2018
- OpenSSL Header Version OpenSSL 1.1.0h 27 Mar 2018
- Openssl default config /usr/lib/ssl/openssl.cnf
If you need futher information feel free to task.
Edit:
From apache error.log
PHP Warning: 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 on line 0
[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: Command line: '/usr/sbin/apache2'
[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 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
Solution 1:[1]
I had the same problem.
It seems like i created it by manually enable
extension=openssl
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kalipso |