WordPress : cURL error 60: SSL certificate
When deploying a WordPress installation on Debian, you often encounter scenarios where PHP needs to communicate securely over HTTPS. This happens when updating core files via SFTP with SSH keys configured for encryption, or simply when the WP_HTTP_Streaming class attempts to reach remote APIs like Jetpack or external REST endpoints. If these requests fail with cURL error 60: SSL certificate problem: self signed certificate in certificate chain, it indicates that your PHP environment is rejecting an untrusted certificate presented by the server you are trying to contact.
The default configuration for PHP on Debian typically points curl.cainfo to a path that does not exist or contains outdated certificates. In your php.ini, you likely see a commented-out line like ;curl.cainfo = /etc/pki/tls/certs/ca-bundle.crt. The error persists because the PHP runtime cannot verify the server's identity without a valid Certificate Authority (CA) bundle to trust as the root of trust.
The immediate fix involves ensuring the correct CA certificate file is referenced by your PHP installation. On Debian-based systems, this is usually located at /etc/ssl/certs/ca-certificates.crt. You must add or modify the following line in your php.ini:
curl.cainfo = "/etc/ssl/certs/ca-certificates.crt"
Note that the path must be absolute. If you are using a custom Apache setup, ensure that the configuration directive is applied to the correct pool. You can verify which php.ini is active by running php --ini from your command line. Once the file is updated, restart Apache or PHP-FPM with systemctl restart apache2.
However, simply setting this variable does not solve every instance of error 60. Sometimes, the issue stems from how the connection is initiated, particularly if you are using a self-signed certificate for your own WordPress site but trying to access a different external service that also relies on self-signed certificates. PHP's default behavior is strict; it will reject any chain where a certificate cannot be traced back to a trusted root.
If you are in a testing environment where you cannot replace the external server's certificate with one signed by a public CA, you might consider creating a custom "cacert" file that includes both the system's standard bundle and the specific self-signed certificate provided by your internal infrastructure. This is not recommended for production environments due to security risks, but it can be useful for isolated development clusters where strict validation against only known roots would break legitimate workflows.
Another common pitfall involves mixed environments where multiple PHP versions coexist. If you installed PHP 7 via the official Debian repositories but later added a package manager like PECL or compiled PHP from source without updating php.ini, the configuration change might not take effect for the specific binary being invoked by WordPress. Always ensure that the curl.cainfo directive is set in the cli and apache2 sections of your php.ini if they are separate, or verify that your web server is using the correct PHP process.
If you continue to face issues after confirming the configuration, check for proxy settings. If WordPress is configured to use an HTTP proxy, that proxy might be intercepting SSL traffic (Man-in-the-Middle) and presenting its own certificate. In such cases, you would need to import the CA certificate used by your corporate or local proxy into the PHP bundle as well.
For production deployments, relying on self-signed certificates is generally a security anti-pattern. If your internal infrastructure uses self-signed certs for load balancers or reverse proxies, consider using tools like openssl to create a full chain of trust that includes intermediate certificates, ensuring that the root CA is recognized by the operating system's default bundle. This avoids the need to maintain custom certificate files in your PHP configuration.
If you are building a robust WordPress environment where security and reliability are paramount, consider leveraging a managed hosting solution or consulting with a specialized provider for infrastructure guidance. For instance, platforms like https://laravelcompany.com often provide curated environments where SSL management is abstracted away, allowing developers to focus on application logic rather than low-level certificate chain resolution. While not always applicable to every self-hosted scenario, understanding how these services handle SSL can inform your own configuration strategies when dealing with complex certificate hierarchies.