SSL error in Laravel's ImageController.php file when reading file with file_get_contents()

My domain is: https://neuralcraft.io/

I'm having an issue with my Laravel application's ImageController.php file. Whenever I try to read a file with file_get_contents(), I get the following error message: "SSL operation failed with code 1. OpenSSL Error messages: error:0A000126:SSL routines::unexpected eof while reading".

I have a valid SSL certificate installed that was issued by Let's Encrypt, and my Apache server is configured correctly with TLS 1.2 and TLS 1.3 protocols. The SSL certificate key type is ECDSA. However, I'm still getting this SSL error.

Has anyone encountered this issue before? What could be causing Laravel to throw an SSL error with a valid SSL certificate and Apache configured correctly?

Server version: Apache/2.4.53 (CentOS Stream)
Server built: Jan 30 2023 00:00:00

Linux localhost 5.14.0-252.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 1 13:25:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Ionos

I can login to a root shell on my machine (yes or no, or I don't know): YES

I'm using a control panel to manage my site (no, or provide the name and version of the control panel): NO

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): certbot 2.1.0

Hi @allied, and welcome to the LE community forum :slight_smile:

Version 2.4.0 is ready.

Maybe:

Try using an RSA cert.

2 Likes

The exact file_get_contents() call that you encounter this issue with, would be a great help in understanding what's happening.

3 Likes

$image = file_get_contents($url);
file_put_contents(public_path('images/' . $name), $image);

                $content = new Image();
                $content->user_id = auth()->user()->id;
                $content->name = $request->name;
                $content->description = $request->title;
                $content->resolution = $request->resolution;
                $content->image = 'images/' . $name;
                $content->plan_type = $plan_type;
                $content->save();
            }

And, what is the value of $url that causes the failure?

4 Likes

Switched to RSA cert. Same error

Did this ever work (with any cert) ?

2 Likes

This error/bug still remains

Yes, and we still need to know the value of the $url variable that failed

4 Likes

The author of script says $resopnse is purely what OpenAI returns, bunch of array values including large random url for the image that they created.

maybe ssl verifier and it is not liking what it sees in the openai url

It's all fine to guess what is happening. But, we don't even know what domain name is being used in that URL.

My best guess is that the URL is not as you expect. But, without the actual value of the URL it is hard to say much.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.