How do I connect to a MySQL database over SSL with Laravel 5.3

后端 未结 3 1918
难免孤独
难免孤独 2020-12-20 08:38

I\'ve been searching all over the internet and haven\'t had any success.

eg: https://laravel.io/forum/06-18-2014-connecting-mysql-over-ssl?page=1 https://laracasts

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 09:14

    You need to provide the full path to the files. If they're in your laravel application folder then you can use the base_path method to generate the full poth. You may also need to define the cert and ca.

    'options' => [
        PDO::MYSQL_ATTR_SSL_KEY => base_path('ssl/client-key.pem'),
        PDO::MYSQL_ATTR_SSL_CERT => base_path('ssl/client-cert.pem'),
        PDO::MYSQL_ATTR_SSL_CA => base_path('ssl/ca-cert.pem')
    ]
    

提交回复
热议问题