# Database SSL Connection Settings

**URL:** <https://forum.mautic.org/t/database-ssl-connection-settings/34419>\
**Category:** Ideas and Feature Requests\
**Created:** [December 12, 2024, 2:02pm UTC](https://forum.mautic.org/t/database-ssl-connection-settings/34419 "2024-12-12T14:02:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruggerbc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ruggerbc/32/13312_2.png) [@ruggerbc](https://forum.mautic.org/u/ruggerbc)\
**Post date:** [December 12, 2024, 2:02pm UTC](https://forum.mautic.org/t/database-ssl-connection-settings/34419/1 "2024-12-12T14:02:06Z")

</div>

My idea is:  
Add support for SSL connection to the database (Useful for Cloud based DB)

I think these groups of people would benefit from this idea:  
People that would like to use Cloud Based Databases

Why I think they would benefit from this idea:  
Ease of setup

Any code or resources to support this idea:  
Add two fields to local.php

- ‘db\_ssl’ =\> true
- ‘db\_ca\_file’ =\> ‘pathtocafile’

And an if statement that adds  
PDO::MYSQL\_ATTR\_SSL\_CA =\> ‘%mautic.db\_ca\_file%’  
to this section of the app/config/config.php file  
$container-\>loadFromExtension(‘doctrine’, [  
‘dbal’ =\> [  
‘default\_connection’ =\> ‘default’,  
‘connections’ =\> [  
‘default’ =\> $connectionSettings,  
‘unbuffered’ =\> array\_merge($connectionSettings, [  
‘options’ =\> [  
PDO::MYSQL\_ATTR\_USE\_BUFFERED\_QUERY =\> false,  
PDO::ATTR\_STRINGIFY\_FETCHES =\> true, // @see [PHP: Backward Incompatible Changes - Manual](https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql)  
PDO::MYSQL\_ATTR\_SSL\_CA =\> ‘%mautic.db\_ca\_file%’,  
],  
]),  
],  
‘types’ =\> [  
Types::ARRAY =\> Type\ArrayType::class,  
Types::DATETIME\_MUTABLE =\> Type\UTCDateTimeType::class,  
Types::DATETIME\_IMMUTABLE =\> Type\UTCDateTimeImmutableType::class,  
Type\GeneratedType::GENERATED =\> Type\GeneratedType::class,  
],  
],  
‘orm’ =\> [  
‘auto\_generate\_proxy\_classes’ =\> ‘%kernel.debug%’,  
‘auto\_mapping’ =\> true,  
‘mappings’ =\> $bundleMetadataBuilder-\>getOrmConfig(),  
‘dql’ =\> [  
‘string\_functions’ =\> [  
‘match’ =\> DoctrineExtensions\Query\Mysql\MatchAgainst::class,  
],  
],  
‘result\_cache\_driver’ =\> [  
‘type’ =\> ‘pool’,  
‘pool’ =\> ‘doctrine\_result\_cache’,  
],  
],  
]);  
Are you willing to work on this idea?:  
Unfortunately not a PHP or Mysql user.

What skills and resources do you need to explore this further?

---

<div class="post-metadata">

**Author:** ![mneumann](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mneumann/32/2512_2.png) [@mneumann](https://forum.mautic.org/u/mneumann)\
**Post date:** [December 17, 2024, 3:39pm UTC](https://forum.mautic.org/t/database-ssl-connection-settings/34419/2 "2024-12-17T15:39:04Z")

</div>

Did you manage to connect making those alterations? is that info for Mautic 4 or Mautic 5 only? I have the same problem and am looking for a solution.

---

<div class="post-metadata">

**Author:** ![ruggerbc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ruggerbc/32/13312_2.png) [@ruggerbc](https://forum.mautic.org/u/ruggerbc)\
**Post date:** [December 17, 2024, 4:22pm UTC](https://forum.mautic.org/t/database-ssl-connection-settings/34419/3 "2024-12-17T16:22:18Z")

</div>

I created the db\_ca\_file field in config/local.php

and added PDO::MYSQL\_ATTR\_SSL\_CA =\> ‘%mautic.db\_ca\_file%  
to the app/config/config.php

And it working with a cloud based provider for me.  
John

---

<div class="post-metadata">

**Author:** ![ruggerbc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ruggerbc/32/13312_2.png) [@ruggerbc](https://forum.mautic.org/u/ruggerbc)\
**Post date:** [December 18, 2024, 10:50am UTC](https://forum.mautic.org/t/database-ssl-connection-settings/34419/4 "2024-12-18T10:50:27Z")

</div>

Just want to add that the settings are lost in the app/config/config.php when you upgrade your version.

John

---

<div class="post-metadata">

**Author:** ![mneumann](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mneumann/32/2512_2.png) [@mneumann](https://forum.mautic.org/u/mneumann)\
**Post date:** [December 18, 2024, 12:37pm UTC](https://forum.mautic.org/t/database-ssl-connection-settings/34419/5 "2024-12-18T12:37:48Z")

</div>

I see that you add some parameters to local.php, but you alter also something in the config.php The related section on my system reads the following:

```auto
$container->loadFromExtension('doctrine', [
    'dbal' => $dbalSettings,
    'orm' => [
        'auto_generate_proxy_classes' => '%kernel.debug%',
        'auto_mapping' => true,
        'mappings' => $bundleMetadataBuilder->getOrmConfig(),
        'dql' => [
            'string_functions' => [
                'match' => \DoctrineExtensions\Query\Mysql\MatchAgainst::class,
            ],
        ],
    ],
]);

```

So do I need to add all the code you have there above? That is relevant for Mautic 4 and Mautic 5 alike? With which version did you test it? Because what I see the real magic happens there in the config.php

---

<div class="post-metadata">

**Author:** ![ruggerbc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ruggerbc/32/13312_2.png) [@ruggerbc](https://forum.mautic.org/u/ruggerbc)\
**Post date:** [December 18, 2024, 1:14pm UTC](https://forum.mautic.org/t/database-ssl-connection-settings/34419/6 "2024-12-18T13:14:45Z")

</div>

I am using Mautic 5  
The parameters in the local.php are just for ease of editing as I would think that you wouldn’t want to mess around in the app/config/config.php too much 😉  
And where I put the **PDO::MYSQL\_ATTR\_SSL\_CA** was above your orm section.  
So, I am not sure where it would go in your config.php but I would be looking for what _ **$dbalSettings** _ is referencing  
You probably have something just above.

John
