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.
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"
或者您可能在本地尝试 HTTP,然后在实时服务器上更改为 HTTPS
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.