PHP startup issue in Ubuntu: Unable to load dynamic library "openssl"
P粉512363233
P粉512363233 2024-03-25 17:29:37
0
1
648

I got the error message in the question title, or rather I got 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 problem is that it only happens sometimes and not always. One second the request works and another second I get a 500 internal error on the same request with this message.

This started happening after I enabled apache proxy and proxy_wstunnel mods, but it could also be apt-get update 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 March 27, 2018
  • OpenSSL header version OpenSSL 1.1.0h March 27, 2018
  • Openssl default configuration /usr/lib/ssl/openssl.cnf

If you need more information, please feel free to complete the 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) 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)) unknown at line 0 < /p>

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

[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 in /var/ Send /html_back/vendor/yiisoft/yii2/web/Response.php line 414 from www. Located at /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 throws /var/www/html_back/vendor/yiisoft/yii2/web/ Response.php 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 in /var/ Send /html_back/vendor/yiisoft/yii2/web/Response.php line 414 from www. Located at /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 throws /var/www/html_back/vendor/yiisoft/yii2/web/ Response.php line 366

P粉512363233
P粉512363233

reply all(1)
P粉555696738

I also encountered the same problem.

Looks like I created it by enabling it manually

extension=openssl

In php.ini. After disabling 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!