17

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

7
  • 1
    Check and post your apache logs. Commented Apr 20, 2018 at 7:14
  • @MikeStratton appended the content of var/log/apache2/error.log Commented Apr 20, 2018 at 7:26
  • In the terminal type: "sudo openssl -v" (without quotes) and post results. Commented Apr 20, 2018 at 7:29
  • sudo openssl -v did not work, but sudo openssl version returns OpenSSL 1.1.0h 27 Mar 2018 Commented Apr 20, 2018 at 7:31
  • 1
    It looks like your apt-get update might have removed the version of openssl you were using before the update. Commented Apr 20, 2018 at 7:33

1 Answer 1

12

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.