Hiroki
Hiroki

Reputation: 4163

TCPDF: getimagesize(): SSL operation failed with code 1 error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

I've been using TCPDF. In my local machine, TCPDF works fine, but it throws an error in the actual server. The error message is as follows.

Message: getimagesize(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

Message: getimagesize(): Failed to enable crypto

getimagesize(http:/test.com/images/sample.jpg): failed to open stream: operation failed

If I understand them right, this application couldn't verify the SSL certificate of the server.

So, following this example, I put get the signature in the following way.

$pdf  = new TCPDF();
$certificate = '/blahblah/certs/certificate.crt';
$pdf->setSignature($certificate, $certificate, 'pdfgen', '', 2, []);

Still, I'm seeing the same error.

When TCPDF throws this "SSL operation failed with code 1" error, what does it mean?

Any help will be appreciated.

Upvotes: 5

Views: 7088

Answers (3)

Bergi
Bergi

Reputation: 361

This Problem take me hours! I have a ngnix Server. The only thing I had to do is to paste the content of "mykey.ca" file at the end of the "mykey.crt" file, save it as new file "newBothKey.crt" and set this file in "/etc/nginx/sites-available"

listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/.ssl/sitename/newBothKey.crt;
ssl_certificate_key /etc/nginx/.ssl/sitename/mykey.key;
ssl_protocols TLSv1.2;

Don't forget to restart nginx:

sudo systmctl restart nginix

Upvotes: 0

Shareque
Shareque

Reputation: 139

or maybe you try HTTP locally and then change to HTTPS on the live server

Upvotes: 0

José Silva
José Silva

Reputation: 401

I had the same problem using the library html2pdf that needs to get the image size through the PHP function getsizeimage() and my image URL was with https so I solved by specifying in my php.ini file the SSL certificate.

[openssl]
openssl.cafile="/etc/nginx/tls/yourCert.crt"

Upvotes: 2

Related Questions