经过了一整天的调查,为什么我不能让我的应用程序通过SSL使用PHP PDO连接到远程服务器,我发现PDO :: MYSQL_ATTR_SSL …,但它似乎只存在于5.3.7或更高。
我的问题是这个。 SSL支持仅适用于PHP 5.3.7及以上版本吗? 还是我的结论不正确?
相关文档ssl支持在5.3.7中介绍。
更改日志:
- 5.4.0不再支持MySQL客户端库4.1及以下版本。
- 5.3.9增加了对mysqlnd和OpenSSL的SSL支持。
- 5.3.7增加了对libmysqlclient和OpenSSL的SSL支持。
而物业只适用于5.3.7或以上。
PDO::MYSQL_ATTR_SSL_CA (integer) The file path to the SSL certificate authority. This exists as of PHP 5.3.7. PDO::MYSQL_ATTR_SSL_CAPATH (integer) The file path to the directory that contains the trusted SSL CA certificates, which are stored in PEM format. This exists as of PHP 5.3.7. PDO::MYSQL_ATTR_SSL_CERT (integer) The file path to the SSL certificate. This exists as of PHP 5.3.7. PDO::MYSQL_ATTR_SSL_CIPHER (integer) A list of one or more permissible ciphers to use for SSL encryption, in a format understood by OpenSSL. For example: DHE-RSA-AES256-SHA:AES128-SHA This exists as of PHP 5.3.7. PDO::MYSQL_ATTR_SSL_KEY (integer) The file path to the SSL key. This exists as of PHP 5.3.7.
另请参阅 : http : //php.net/manual/en/ref.pdo-mysql.php
对于SSL支持,您必须启用php_openssl模块。 否则,你没有libs连接。 这里例如与file_get_contents相同。
检查模块是否被激活,并安装openssl。
如果您使用的是Linux系统,则可以通过软件包pipe理器安装该模块。