[Solved] 500 error on installation after submitting db credentials details

Your software
My Mautic version is: 3.2.1
My PHP version is: PHP/7.2.34
Server: Apache/2.4.38
My Database type and version is: mysql:5.7

Your problem
My problem is: 500 error on installation after submitting db credentials details

These errors are showing in the log:

PHP/Apache Logs

php_1  | [Sat Dec 26 21:18:57.308116 2020] [php7:warn] [pid 27] [client 172.18.0.1:56116] PHP Warning:  Cannot use a scalar value as an array in /var/www/html/app/bundles/InstallBundle/Install/InstallService.php on line 337, referer: http://localhost/index.php/installer/step/1
php_1  | 172.18.0.1 - - [26/Dec/2020:21:18:56 +0000] "POST /index.php/installer/step/1 HTTP/1.1" 500 61062 "http://localhost/index.php/installer/step/1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0"

Mautic Logs:

[2020-12-26 21:18:57] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ConnectionException: "An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory" at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 93 {"exception":"[object] (Doctrine\\DBAL\\Exception\\ConnectionException(code: 0): An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:93, Doctrine\\DBAL\\Driver\\PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] No such file or directory at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)"} [] 

Steps I have tried to fix the problem:

  • None yet

Looks like unrelated to Mautic (although exception could have been handled better in Mautic).

MySQL connection couldn’t be established.

If you are using docker with 2 different containers each for php and mysql, try giving host.docker.internal instead of localhost or 127.0.0.1 or 0.0.0.0

That worked.