Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

mysql: add prerequisite for ca.pem permissions while connecting to mysql with php #2294

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/products/mysql/connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$conn .= "host=" . $fields["host"];
$conn .= ";port=" . $fields["port"];;
$conn .= ";dbname=defaultdb";
$conn .= ";sslmode=verify-ca;sslrootcert=ca.pem";
$conn .= ";sslmode=verify-ca;sslrootcert='D:/absolute/path/to/ssl/certs/ca.pem";

try {
$db = new PDO($conn, $fields["user"], $fields["pass"]);
Expand Down
7 changes: 7 additions & 0 deletions docs/products/mysql/howto/connect-with-php.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@
--------------

* :doc:`/docs/platform/howto/download-ca-cert` from `Aiven Console <https://console.aiven.io/>`__ > the **Overview** page of your service. This example assumes it is in a local file called ``ca.pem``.
* Make sure you have read/write permissions to the `ca.pem` file and you add an absolute path to this file into :ref:`the code <connect-mysql-php-code>`:

Check failure on line 21 in docs/products/mysql/howto/connect-with-php.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/products/mysql/howto/connect-with-php.rst#L21

[Aiven.common_replacements] Use 'MySQL' instead of 'mysql'.
Raw output
{"message": "[Aiven.common_replacements] Use 'MySQL' instead of 'mysql'.", "location": {"path": "docs/products/mysql/howto/connect-with-php.rst", "range": {"start": {"line": 21, "column": 137}}}, "severity": "ERROR"}

.. code-block:: bash

$conn .= ";sslmode=verify-ca;sslrootcert='D:/absolute/path/to/ssl/certs/ca.pem

.. note::
Your PHP installation needs to include the `MySQL functions <https://www.php.net/manual/en/ref.pdo-pgsql.php>`_ (most installations have this already).

.. _connect-mysql-php-code:

Code
----

Expand Down
Loading