【发布时间】:2017-11-14 03:13:23
【问题描述】:
我需要更改旧的 Symfony 1.4 应用程序,以便它能够通过 ssl-connection 连接到 mysql。
我为 Symfony >= 2 找到了很多关于此的内容。但不幸的是,对于这个尘土飞扬的人来说不是。
出于验证目的,我已经通过编辑使其工作
./apps/frontend/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Connection.php
$this->dbh = new PDO($this->options['dsn'], $this->options['username'],
(!$this->options['password'] ? '':$this->options['password']), array(PDO::ATTR_PERSISTENT => true));
到
$this->dbh = new PDO($this->options['dsn'], $this->options['username'],
(!$this->options['password'] ? '':$this->options['password']),
array(PDO::ATTR_PERSISTENT => true,
PDO::MYSQL_ATTR_SSL_KEY => '/etc/my.cnf.d/ssl/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT => '/etc/my.cnf.d/ssl/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA => '/etc/my.cnf.d/ssl/ca-cert.pem'));
但我想知道这个丑陋的 hack 是否真的是唯一的解决方案?
【问题讨论】:
标签: php mysql ssl doctrine symfony-1.4