1

After a solid day investigating why I can't get my application to connect to a remote server over SSL using PHP PDO, I found PDO::MYSQL_ATTR_SSL..., but it seems that they exists only for 5.3.7 or above.

My Question is this. Is SSL support only available for PHP 5.3.7 and above? Or am I incorrect in my conclusions?

2 Answers2

2

For SSL Support you have to enable the php_openssl module. Otherwise you haven't the libs to make a connection. Here the same with file_get_contents for example.

Check if the module is activated and openssl is installed.

if you use a linux system you can install the module over the package manager.

René Höhle
  • 1,418
  • 3
  • 17
  • 26
1

According documentation ssl support is introducing in 5.3.7.

Change log:

  • 5.4.0 MySQL client libraries 4.1 and below are no longer supported.
  • 5.3.9 Added SSL support with mysqlnd and OpenSSL.
  • 5.3.7 Added SSL support with libmysqlclient and OpenSSL.

and properties are only available y 5.3.7 or above.

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.

Se also: http://php.net/manual/en/ref.pdo-mysql.php

Federico Sierra
  • 3,499
  • 1
  • 18
  • 24