# Out of the blue DBA Exception - Mautic down

**URL:** <https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858>\
**Category:** Product Support\
**Created:** [March 1, 2022, 8:16am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858 "2022-03-01T08:16:03Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [March 1, 2022, 8:16am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/1 "2022-03-01T08:16:03Z")

</div>

**Your software**  
My Mautic version is: 4.x  
My PHP version is: 7.4  
My Database type and version is: mysql Ver 15.1 Distrib 10.3.34-MariaDB, for debian-linux-gnu (x86\_64) using readline 5.2

**Your problem**  
My problem is:  
This morning all of a sudden we had a number of our Mautic installations loose connection to their DB and showing site offline. It happened out of the blue - there were no server updates done, no mautic update.  
Happened on servers running ubuntu on both DO and AWS

These errors are showing in the log:

```auto
https://github.com/doctrine/DoctrineBundle/issues/673 - in file /var/www/mautic/vendor/doctrine/doctrine-bundle/ConnectionFactory.php - at line 134" while reading response header from upstream, client: 71.6.232.7, server: mautic.domain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "123.123.123.123"
2022/03/01 07:11:09 [error] 2108352#2108352: *45 FastCGI sent in stderr: "PHP message: Doctrine\DBAL\DBALException: An exception occurred while establishing a connection to figure out your platform version.
You can circumvent this by setting a 'server_version' configuration value

```

Steps I have tried to fix the problem:  
Tried to restart all services.  
Looked around the internet for possible solutions.  
Checked out relevant GitHub, there was also a closed issue posted on Mautic Github ([An exception occurred while establishing a connection to figure out your platform version. · Issue #10729 · mautic/mautic · GitHub](https://github.com/mautic/mautic/issues/10729))  
Spoke with @joeyk

Finally rebooted server. Took over 5 minutes for server to go up and down. After which everything resumed back to normal.

If anyone has any insight to the problem, how it can occur or why - would be great to know. Happy to assist with testing or doing any tasks.  
Or if anyone knows where to set this server\_version inside Mautic or on ubuntu

---

<div class="post-metadata">

**Author:** ![ekke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ekke/32/296_2.png) [@ekke](https://forum.mautic.org/u/ekke)\
**Post date:** [March 1, 2022, 9:15am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/2 "2022-03-01T09:15:57Z")

</div>

this is multiple MariaDB servers? or all Mautic instances connecting to the same?

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [March 1, 2022, 9:27am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/3 "2022-03-01T09:27:06Z")

</div>

all single instances on single servers.

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [March 1, 2022, 9:51am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/4 "2022-03-01T09:51:34Z")

</div>

I have just checked another server and it seems to be related to mysql.  
When looking at the process’s running I noticed two for mysql.  
I tried to restart mysqld and it just kind of hung, using systemctl restart.  
tried to stop using systemctl and hung as well.  
ran kill -9 on PID and this fixed the issue.

I am still in the dark as why this happened or would happen

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [March 1, 2022, 11:45am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/5 "2022-03-01T11:45:36Z")

</div>

Doctrine requires the DB version is specified:

> **[Doctrine Configuration Reference (DoctrineBundle) (Symfony Docs)](https://symfony.com/doc/current/reference/configuration/doctrine.html#doctrine-dbal-configuration)**

I’ve just checked the file `app/config/local.php` and it seems it doesn’t specify the version.

@ekke , this is something Mautic should address, as it may cause issues like this in this issue.

---

<div class="post-metadata">

**Author:** ![ekke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ekke/32/296_2.png) [@ekke](https://forum.mautic.org/u/ekke)\
**Post date:** [March 1, 2022, 4:31pm UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/6 "2022-03-01T16:31:24Z")

</div>

@aerendir not sure why it would hit out of blue sky, though… any thoughts?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [March 1, 2022, 4:53pm UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/7 "2022-03-01T16:53:53Z")

</div>

@aerendir we do not specify it in the local.php any more since Mautic 4.0.

Please reference the detailed writeup in this PR:

> <https://github.com/mautic/mautic/pull/9739>
>
> | Q | A
> | --------------------------------…------ | ---
> | Branch? | features
> | Bug fix? | yes and no
> | New feature? | no
> | Deprecations? | no
> | BC breaks? | yes
> | Automated tests included? | no
> | Related user documentation PR URL | N/A
> | Related developer documentation PR URL | N/A
> | Issue(s) addressed | Fixes #... 
> 
> \<!--
> Additionally (see https://contribute.mautic.org/contributing-to-mautic/developer/code/pull-requests#step-5-work-on-your-pull-request):
> - Always add tests and ensure they pass.
> - Bug fixes must be submitted against the lowest maintained branch where they apply
> (lowest branches are regularly merged to upper ones so they get the fixes too.)
> - Features and deprecations must be submitted against the "features" branch.
> \--\>
> 
> \<!--
> Please write a short README for your feature/bugfix. This will help people understand your PR and what it aims to do.
> \--\>
> \## Description
> 
> Mautic currently has a hardcoded \`server\_version\` config parameter, set to '5.7'. However, this is problematic for a few reasons:
> \- Version 5.7 assumes MySQL, while MariaDB has a different versioning scheme (10.1, 10.2, etc.). Officially, if the \`server\_version\` is hardcoded and the database type is MariaDB, \[it needs to be prefixed\](https://symfony.com/doc/current/reference/configuration/doctrine.html) by \`mariadb-{VERSION}\`, so that Doctrine knows it's MariaDB. Mautic currently doesn't do this, so Doctrine always thinks it's interacting with MySQL.
> \- The hardcoded version is written to Mautic's \`config/local.php\` file, so without a migration it won't be updated automatically if Mautic's minimal database version requirement changes. This has led to problems before; see https://github.com/mautic/mautic/pull/9437 as an example.
> 
> Since version 2.5, Doctrine has \[automatic platform version detection\](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#automatic-platform-version-detection) built-in. So it will recognize if e.g. the minimum MySQL version is 5.7, required for some functionality that was only added in version 5.7.
> 
> As far as I know, there's no need (anymore) for Mautic to hardcode the database server version, hence this PR.
> 
> This PR also adds a new tab "Database info" to the "System info" page for easier debugging/troubleshooting:
> 
> !\[image\](https://user-images.githubusercontent.com/17739158/109433068-c2b98100-7a0e-11eb-8f2e-c26fa288caff.png)
> 
> !\[image\](https://user-images.githubusercontent.com/17739158/109433073-c64d0800-7a0e-11eb-95e0-6e26098b9143.png)
> 
> \<!--
> If you are fixing a bug and if there is no linked issue already, please provide steps to reproduce the issue here.
> \--\>
> 
> \## Why database auto-detection is tricky in the installer
> 
> When Mautic isn't installed yet, you'll get an exception in the installer when no explicit \`server\_version\` is set:
> 
> !\[image\](https://user-images.githubusercontent.com/17739158/116829835-863d0980-aba6-11eb-842f-3d248d54352a.png)
> 
> This was \[already reported\](https://github.com/doctrine/DoctrineBundle/issues/351#issuecomment-68962538) by @alanhartless to the Doctrine team in 2015, with no good fix for Mautic's use case to date.
> 
> The good news is that we can set a \`server\_version\` manually in the installer, until the database credentials are set. The order of steps is as follows then:
> 
> 1. Mautic sets temporary \`server\_version\` to \`5.7\` in the installer
> 1. User enters DB config in Mautic's installer UI (db host, name, etc.)
> 1. Mautic recognizes that the DB config has been entered and switches over to Doctrine's automatic platform detection
> 1. Mautic installs the database schema (\`installSchema()\` below)
> 
> This order of steps is crucial. During my testing, before I had a fix for this in place, the detected database platform remained \`MySQL\` and it stayed like that until I removed the cache. In order to prevent issues in the future, we want step 3 (switch to automatic platform detection \_before\_ installing the schema) to happen first.
> 
> I came up with a somewhat ugly fix for this in the \`AppKernel\` by setting a constant called \`MAUTIC\_DB\_NOT\_CONFIGURED\` that the installer can recognize. That way it knows exactly when to switch over to automatic database platform detection.
> 
> \*\*Step 1.0 in the installer\*\* (user sets database credentials):
> 
> !\[image\](https://user-images.githubusercontent.com/17739158/116829761-fd25d280-aba5-11eb-81c1-5bff3941ddbb.png)
> 
> \*\*Step 1.1 in the installer\*\* (Mautic now switches to automatic database platform detection, prior to installing the schema):
> 
> !\[image\](https://user-images.githubusercontent.com/17739158/116829765-03b44a00-aba6-11eb-8011-e212641d6e7d.png)
> 
> During schema installation, the correct database platform (MariaDB in this case) is indeed detected:
> 
> !\[image\](https://user-images.githubusercontent.com/17739158/116829769-07e06780-aba6-11eb-9692-3e858da922bf.png)
> 
> \#### Steps to test this PR:
> 1. Load up this PR locally
> 2. Ensure Mautic's installer works correctly (ideally try both with MariaDB and MySQL, and both UI + CLI installations)
> 3. Check if the "database info" tab works as expected under \`System info \> Database info\`
> 4. Run \`php bin/console doctrine:schema:update --dump-sql\`, it should return less than 10 queries to be executed
> 5. Try to do a clean installation based on the \`features\` branch. Ensure your \`app/config/local.php\` has a \`db\_server\_version\` parameter (if it doesn't show up right away, go to Configuration in Mautic's UI and hit Save). Then checkout this PR and run \`php bin/console doctrine:migrations:execute --up 20210502162314\`. The \`db\_server\_version\` parameter should now be removed from your \`app/config/local.php\` file.
> 
> \<!--
> If you have any deprecations, list them here along with the new alternative.
> If you have any backwards compatibility breaks, list them here.
> \--\>

---

<div class="post-metadata">

**Author:** ![aerendir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aerendir/32/1050_2.png) [@aerendir](https://forum.mautic.org/u/aerendir)\
**Post date:** [March 2, 2022, 10:37am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/8 "2022-03-02T10:37:53Z")

</div>

So, maybe the detection doesn’t work well?

The error is clear: it requires the database version to be set, so somewhere in the process of setting the version there is an error.

Maybe this is a bug of Doctrine… I don’t know…

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [March 7, 2022, 11:05am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/9 "2022-03-07T11:05:28Z")

</div>

Hi folks I had the same issue. That’s what I made and what I had:

1. I made a backup of Mautic (files and db)
2. I copy all in a new server
3. I gone to /app/config.php and correct all I need  
I had this error:

* * *

## An exception occurred while establishing a connection to figure out your platform version. You can circumvent this by setting a ‘server\_version’ configuration value For further information have a look at: [BC break between 1.6.7 -\> 1.6.8 regarding driver selection · Issue #673 · doctrine/DoctrineBundle · GitHub](https://github.com/doctrine/DoctrineBundle/issues/673)

Than i tried:  
‘db\_server\_version’ =\> ‘5.1’  
‘db\_server\_version’ =\> ‘mariadb-10.3.27’  
nothing change.  
Can you help me?

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [March 7, 2022, 11:31am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/10 "2022-03-07T11:31:12Z")

</div>

Try and restart MySQL

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [March 7, 2022, 11:48am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/11 "2022-03-07T11:48:44Z")

</div>

Thanks @mikew, my customer is on a shared hosting, I’ll open a ticket let me try 😉

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [March 8, 2022, 1:17am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/12 "2022-03-08T01:17:31Z")

</div>

Running Mautic on a “shared hosting” plan is trouble looking for a place to happen. One of the newest examples in the upgrade from UI is going away in Mautic 5. Another is not being able to troubleshoot or run manual actions in the case of this issue. The “out of the blue” nature of this issue may be caused by a host restart of your VPS or the DB server.

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [March 8, 2022, 7:06am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/13 "2022-03-08T07:06:16Z")

</div>

> [@EJL](#):
>
> Running Mautic on a “shared hosting” plan is trouble looking for a place to happen.

Thanks but not everyone can afford a personal server, the important thing is to be aware of it

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [March 8, 2022, 8:31am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/14 "2022-03-08T08:31:30Z")

</div>

Hey @antonio-lazzari

That is correct, however did you know that you can run a good version of Mautic on a $5 server/month. Not sure how much you are paying for shared hosting, but something to maybe bring up with your customer

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [March 8, 2022, 10:58am UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/15 "2022-03-08T10:58:54Z")

</div>

5$ server/month? where?

---

<div class="post-metadata">

**Author:** ![renatocron](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/renatocron/32/6936_2.png) [@renatocron](https://forum.mautic.org/u/renatocron)\
**Post date:** [March 8, 2022, 12:08pm UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/16 "2022-03-08T12:08:35Z")

</div>

Lot of good options, best price/performance is:  
UpCloud, Vultr, Linode, OVH (harder to use), DigitalOcean, Lightsail

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [March 24, 2022, 2:38pm UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/17 "2022-03-24T14:38:11Z")

</div>

Dears I finally solved it in this way:

1. I installed mautic to the same version
2. I have downloaded the old db in compatibility version mysql40
3. I have uploaded the dump
4. I updated the local.php file
5. I updated to the recent version and did some small setups  
Now all working fine.  
The problem was due to the old hosting service that ruined the db when exporting

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [March 24, 2022, 2:57pm UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/18 "2022-03-24T14:57:04Z")

</div>

Another good option for about 5 eur / month is contabo

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [March 24, 2022, 3:32pm UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/19 "2022-03-24T15:32:19Z")

</div>

Love linode.

---

<div class="post-metadata">

**Author:** ![Yosu\_Cadilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/yosu_cadilla/32/6206_2.png) [@Yosu\_Cadilla](https://forum.mautic.org/u/Yosu_Cadilla)\
**Post date:** [February 15, 2023, 6:29pm UTC](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858/20 "2023-02-15T18:29:38Z")

</div>

> [@silavapi](#):
>
> we do not specify it in the local.php any more since Mautic 4.0.

Where is is stored now @silavapi ? Which table(s)? Which file(s)?

TY!

[Next page](https://forum.mautic.org/t/out-of-the-blue-dba-exception-mautic-down/22858.md?page=2)
