PHP 8.3.4 Released!

mysqli::ssl_set

mysqli_ssl_set

(PHP 5, PHP 7, PHP 8)

mysqli::ssl_set -- mysqli_ssl_setSSL を使用したセキュアな接続を確立する

説明

オブジェクト指向型

public mysqli::ssl_set(
    ?string $key,
    ?string $certificate,
    ?string $ca_certificate,
    ?string $ca_path,
    ?string $cipher_algos
): true

手続き型

mysqli_ssl_set(
    mysqli $mysql,
    ?string $key,
    ?string $certificate,
    ?string $ca_certificate,
    ?string $ca_path,
    ?string $cipher_algos
): true

SSL を使用してセキュアな接続を確立します。 mysqli_real_connect() より前にコールする必要があります。この関数は、 OpenSSL サポートが有効になっていない場合は何もしません。

パラメータ

link

手続き型のみ: mysqli_connect() あるいは mysqli_init() が返す mysqliオブジェクト。

key

鍵ファイルへのパス。

certificate

証明書ファイルへのパス。

ca_certificate

CA ファイルへのパス。

ca_path

信頼された SSL CA 証明書が PEM フォーマットで格納されているディレクトリへのパス。

cipher_algos

SSL の暗号化に使用可能な暗号形式の一覧。

戻り値

常に true を返します。 もし SSL が正しく設定できていない場合、 mysqli_real_connect() は接続時にエラーを返します。

参考

add a note

User Contributed Notes 2 notes

up
0
quackfish at gmail dot com
8 years ago
Be warned, MySQL prior to versions 5.7.3 do not require the server to use SSL [1]. In the case of PHP the client won't throw an error if the connection is downgraded to plain-text [2]

[1] https://dev.mysql.com/doc/refman/5.7/en/encrypted-connection-options.html#option_general_ssl
[2] http://www.idontplaydarts.com/2015/03/mysql-with-ssl-does-not-protect-against-active-mitm/
up
-32
Mike
3 years ago
You no longer need to specify the key - ca or cert to establish a secure connection to MySQL 5.7.3 you can just set ssl
To Top