phpmysqliopenssl

What is meant by "This function does nothing unless OpenSSL support is enabled"?


The PHP manual entry for mysqli_ssl_set() says:

Used for establishing secure connections using SSL. It must be called before mysqli_real_connect(). This function does nothing unless OpenSSL support is enabled.

Does this mean that OpenSSL software must be installed and enabled on the PHP server (running Ubuntu Linux)?


Solution

  • I believe this refers to the PHP OpenSSL extension. It needs to be enabled in your PHP INI file.

    The documentation is not very clear as to what exactly happens, but from what I can observe, if you have the OpenSSL extension disabled then PHP cannot use SSL stream for the MySQL connection. A warning should be generated, and if you then attempt to connect anyway, the connection will fail. The words "This function does nothing" seem to imply that the function will just not work without that extension enabled.

    Another possible way to understand it is that if PHP has been compiled without OpenSSL support at all, then that function truly does nothing (it will compile as an empty function). In that case, you will not see any warning and the connection will succeed but without using SSL.

    This has nothing to do with the standalone OpenSSL software.