Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

arpitkhemka's avatar

Laravel to MySQL over SSL

Need help in connecting laravel app to MySQL over SSL. We have been trying to connect to MySQL over SSL using a regular php program which uses PDO. this works fine. however laravel is not able to connect using the config settings in database.php this is really urgent. this is what i get when i try to execute the app.

2014-12-23 23:16:54] ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2026] SSL connection error: Unable to get certificate' in /var/www/abc-api.acme.com/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:47

0 likes
2 replies
arpitkhemka's avatar

I had done those exact steps, but still it didn't work.

Finally after really taking a hard look at the error i realized that a sample pho test code is able to connect to MySQL over SSL then there must be an issue with the way Laravel is being executed. So i checked the owner of the process which executes Laravel. and gave permissions to that owner for those certificates.

It worked! -- in my case it was www-data.

Thanks!

Please or to participate in this conversation.