-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Warning message when using file_get_contents on hosts with HTTPS #8493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
look very much like #8369 |
This is indeed a duplicate of #8369 |
I read the #8369 but I cant find the current situation. Is it solved? I read the links inside that thread but the only thing I know is that the bug still remains... right? |
@batata004 The other thread is still open so the issue is not solved yet. According to a comment on the bugs.php.net issue there's a workaround. https://gist.github.com/rdh27785/97210d439a280063bd768006450c435d But I haven't tested it. |
@iluuu1994 thank you! I tried the workaround on my server and didnt work. I even rebooted the server in order to make sure openssl was restarted, but the problem remained. I am running Centos 9 Stream. Anyway, I hope someone fixes this, cause this is causing several problens on many servers I manage (I use buffer manipulation on the output with PHP and warning error messages get in my away). I know I can disable warning messages, but the company that certifies us (provides compliance) does not allow disabling warnings. |
would this work for you, guzzle/psr7#504 (comment), P/s: it still silence warning, but at least it throw Exception when thing go wrong. |
@kocoten1992 thank you so much! I will take a look at your suggestion and I think it will be of great help!! Thank you!! |
Description
This bug started happening in the last 30 days when I installed a fresh CentOS with PHP 8.1 and tried to execute the code below. The bug happens with most hosts that use HTTPS (not just in the particular host I showed below):
file_get_contents("https://www.sitepor500.com.br");
The warning I get is this:
Warning</b>: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:0A000126:SSL routines::unexpected eof while reading in <b>/ebs1/apache/www/html
I use PHP for at least 10 years and this is the first time I encounter this error message. I googled it and found some people that managed to find workaround on Ubuntu (not on Centos which I am using) but I think a workaround is not a good solution and so I decided to report this bug here.
A final note: despite
file_get_contents
showing the warning, it fetchs the content of the URL perfectly, no problem there.PHP Version
8.1.any
Operating System
Centos 8 Stream
The text was updated successfully, but these errors were encountered: