当我将配置添加到laravel/lumen以通过ssl连接到mysql服务器时,出现了这个错误。
2018-05-16 10:42:45] lumen.ERROR: exception 'ErrorException' with message 'PDO::__construct(): this stream does not support SSL/crypto' in /var/www/project/vendor/illuminate/database/Connectors/Connector.php:56
我检查了安装的php模块。它表明 openssl
已安装 php -m
然后呢 php-mysqlnd
已安装。
这是我的配置:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => env('DB_PREFIX', ''),
'timezone' => env('DB_TIMEZONE', '+00:00'),
'strict' => false,
'options' => array(
PDO::MYSQL_ATTR_SSL_KEY => '/etc/ssl/certs/mysqlssl/key.pem',
PDO::MYSQL_ATTR_SSL_CERT => '/etc/ssl/certs/mysqlssl/cert.pem',
PDO::MYSQL_ATTR_SSL_CA => '/etc/ssl/certs/mysqlssl/ca-cert.pem',
),
显示mysql正在运行ssl:
1条答案
按热度按时间30byixjq1#
结果是它不能使用localhost或者它不会使用tcp/ip,而是使用不使用ssl的unix套接字。