我正在尝试使用 Propel 对数据库进行逆向工程 reverse
命令。我尝试连接的数据库需要 SSL 证书,这就是我在我的应用程序中连接它的方式:
new PDO(
'mysql:host=localhost;dbname=blog',
'root', '', array(PDO::MYSQL_ATTR_SSL_CA => '/path/ssl-cert.crt'
);
我的 Propel 配置文件:
propel:
database:
connections:
blog:
adapter: mysql
classname: Propel\Runtime\Connection\ConnectionWrapper
dsn: "mysql:host=localhost;dbname=blog"
user: root
password:
options:
PDO::MYSQL_ATTR_SSL_CA: /path/ssl-cert.crt
我收到以下错误:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized option "PDO::MYSQL_ATTR_SSL_CA" under "propel.database.connections.gateway.options"
我读了这篇文章:Secure Propel connection, remote MySQL ,第一个答案链接到旧版本的 Propel,我也尝试了替代答案,将 PDO::MYSQL_ATTR_SSL_CA
替换为其整数值。没有任何效果,以前有人遇到过这个问题吗?我错过了什么?
最佳答案
目前似乎只支持ATTR_PERSISTENT
选项:PropelConfiguration
fork 它并用类似的东西打补丁应该相当容易:
->arrayNode('options')
->children()
->booleanNode('ATTR_PERSISTENT')->defaultFalse()->end()
->scalarNode('PDO::MYSQL_ATTR_SSL_CA')->end()
->end()
->end()
我建议直接在您的 vendor/propel/propel/src/Propel/Common/Config/PropelConfiguration.php
中添加此标量节点,并检查是否存在任何隐藏的错误或缺失的功能。
关于php - 将 PDO::MYSQL_ATTR_SSL_CA 与 Propel ORM 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33836352/