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

Commit

Permalink
Merge pull request #2294 from aiven/dorota-mysql-connet-with-php-fix-…
Browse files Browse the repository at this point in the history
…absolute-path-to-ca-file

mysql: add prerequisite for ca.pem permissions while connecting to mysql with php
wojcik-dorota authored Nov 27, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 1d8e752 + 3900c3f commit af982ae
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion code/products/mysql/connect.php
Original file line number Diff line number Diff line change
@@ -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"]);
7 changes: 7 additions & 0 deletions docs/products/mysql/howto/connect-with-php.rst
Original file line number Diff line number Diff line change
@@ -18,10 +18,17 @@ Pre-requisites
--------------

* :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>`:

.. 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
----

0 comments on commit af982ae

Please sign in to comment.