Home > Article > Backend Development > How to Troubleshoot TLS Email Certificate Verification Errors in Laravel?
Laravel: Troubleshooting TLS Email Certificate Verification Errors
When sending TLS-encrypted emails through Laravel, you may encounter issues related to certificate verification. This is especially true when manually configuring settings or using self-signed certificates.
One common error message you may encounter is "certificate verify failed." This indicates that the target server's certificate cannot be verified against the trusted certificate store on your system.
If your operating system does not automatically manage trusted certificates, follow these steps:
1. Download cURL Certificate Bundle
Download the cURL Certificate Authority (CA) certificate bundle (cacert.pem) from the official cURL website.
2. Place and Edit Certificate Bundle
Place the cacert.pem bundle in a suitable location (e.g., D:/Servers/php/sslfiles/cacert.pem). If you have self-signed certificates you need to accept, open the bundle and add them to the bottom of the file.
3. Edit php.ini
In your php.ini configuration file, add the following lines to reference the downloaded bundle:
curl.cainfo = D:/Servers/php/sslfiles/cacert.pem openssl.cafile = D:/Servers/php/sslfiles/cacert.pem
4. Restart Services
Restart the appropriate services, including PHP-FPM or the web server hosting PHP.
This process ensures that PHP and your server can verify the target server's certificate when sending emails, resolving the "certificate verify failed" error.
The above is the detailed content of How to Troubleshoot TLS Email Certificate Verification Errors in Laravel?. For more information, please follow other related articles on the PHP Chinese website!