Issue:
You’re getting the following error in PHP when calling PDF.co or any HTTPS API:
Peer certificate cannot be authenticated
This happens because your server’s SSL certificates or libraries are outdated or missing.
How to fix it
Step 1: Update your PHP libraries
Run this command in your PHP project directory:
composer update
This updates the certificate authority (CA) bundle and dependencies that PHP uses to validate SSL certificates.
After updating, try your API call again.
Step 2: If the issue persists…
It could be related to your PHP installation or server environment. You can:
Search solutions on StackOverflow: https://stackoverflow.com/search?q=peer+certificate+cannot+be+authenticated+%5Bphp%5D
Ensure openssl is enabled in your
php.ini
Verify that cacert.pem is present and linked in your PHP config
Helpful tips
This is a server-side SSL validation issue → not specific to PDF.co’s servers.
Make sure your server supports TLS 1.2+ and has up-to-date certificate chains.
Try testing your API calls from a different machine to isolate local environment issues.