Skip to main content

PHP - Peer certificate cannot be authenticated

Updated over a month ago

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:

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.

Did this answer your question?