Using Laravel trying to connect with SSL certificate. I’ve coppid the certificate files into the project to ensure it was able to access them ok.
'connections' => [
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => [
PDO::MYSQL_ATTR_SSL_KEY => base_path('ssl/devilbox-ca.key'),
PDO::MYSQL_ATTR_SSL_CERT => base_path('ssl/devilbox-ca.crt'),
PDO::MYSQL_ATTR_SSL_CA => base_path('ssl/devilbox-ca.srl')
],
],
]
Throws error:
SQLSTATE[HY000] [2006] MySQL server has gone away
Following the guide from here and laravel docs: