OpenSSL Error messages: error:0A000126:SSL routines::unexpected eof while reading

Viewed 9595

Screenshot is here

I have built a website in PHP using the YII2 framework. When I use file_get_contents($requestUrl, false, stream_context_create($arrContextOptions)) then i am getting error saying error:0A000126:SSL routines::unexpected eof while reading I have also tried to enable the legacy provider by editing the openssl.cnf file, but got no success. Reference: https://gist.github.com/rdh27785/97210d439a280063bd768006450c435d

Any help would be appriciated.

Server: Nginx (nginx/1.18.0) OS: Ubuntu 22.04 LTS PHP: 7.4.29 Openssl: 1.1.1d

2 Answers

Upgrade your nginx 1.18.0 to the mainline version and the problem will be fixed. To do so:

  1. Execute as sudo: curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor >/usr/share/keyrings/nginx-signing.gpg.
  2. ADD THE LINES in /etc/apt/sources.list:
deb [signed-by=/usr/share/keyrings/nginx-signing.gpg] https://nginx.org/packages/mainline/ubuntu/ jammy nginx
deb-src [signed-by=/usr/share/keyrings/nginx-signing.gpg] https://nginx.org/packages/mainline/ubuntu/ jammy nginx
  1. sudo apt update
  2. sudo apt install nginx

Then restart the nginx server.

I just had the same issue, it looks like its an issue with OpenSSL on Ubuntu 22.04.

I just updated all my packages on the server and now functionality is working as expected.

sudo apt update && sudo apt upgrade -y
Related