PHP mysqli_ssl_set() Function
Example
Create an SSL connection:
Definition and Usage
The mysqli_ssl_set() function is used to create an SSL secure connection. However, this function only works if OpenSSL support is enabled.
**Note:** This function must be called before mysqli_real_connect() .
**Note:** Prior to PHP 5.3.3, the MySQL Native Driver did not support SSL. Since PHP 5.3+, the MySQL Native Driver is enabled by default on Microsoft Windows.
Syntax
mysqli_ssl_set(
connection,key,cert,ca,capath,cipher
)
;
| Parameters | Description |
|---|---|
| connection | Required. Specifies the MySQL connection to use. |
| key | Required. Specifies the pathname of the key file. |
| cert | Required. Specifies the pathname of the certificate file. |
| ca | Required. Specifies the pathname of the certificate authority file. |
| capath | Required. Specifies the pathname of the directory containing trusted SSL CA certificates in PEM format. |
| cipher | Required. Specifies the list of allowed ciphers for SSL encryption. |
Technical Details
| Return Value: | Always returns TRUE. If SSL is not installed correctly, when you attempt to connect,mysqli_real_connect() an error will be returned. |
|---|---|
| PHP Version: | 5+ |
PHP MySQLi Reference Manual