Your software
My Mautic version is: 5.0.3
My PHP version is: 8.1
My Database type and version is: mariadb 10.11.6
Your problem
My problem is: Initial DB connection setup
I’m attempting to install mautic for the first time. I’m using the .zip method.
I can get to the onboarding screen but am unable to connect to my database.
I am trying to use a unix socket connection (I have to connect this way TCP connection won’t work with my topology).
Is there a specific format that the connection needs to be specified with? I have tried “localhost:/tmp/mariadb/mysql.sock” and similar variations but get the error;
An error occured while attempting to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Address not available
I have not tried this, but I think you will need to override the config a bit.
Here is what I have found, maybe it can steer you in the right direction.
Here is the app/config/config.php:
you need to override the connection settings in such a way that you add unix_socket option to the array with the path to your socket. So something like:
Thanks for the response, adding 'unix_socket' => '/run/mysqld/mysql.sock', doesn’t seem to help, are there any other edits I missed?
I’m currently fighting a recursive 301 redirect issue too but think I have that one figured out.
A brief summary of where I am with this;
I initially attempted to set this up by extracting the zip file to the root of an nginx server and had the issue that I can’t connect to the DB via a unix socket. I reconfigured things so I could connect via TCP and once the installation was complete I couldn’t access the dashboard, it was instructing the browser to download a file called “dashboard” which contained php code.
Next I decided the better option would be to just run the official mautic/apache docker container. I have that up and running (after fighting with 301 redirect issues) using the bridge docker network. It can connect to my mariadb container on the same host.
For security reasons I usually run containers in a locked down network environment that doesn’t have access to other containers, hence my need to connect via unix socket. If I move this container to it’s own network (so it can’t connect to mariadb via TCP) it breaks (as expected). I have the mariadb unix socket passed into the mautic container at /run/mysqld/mysql.sock (this works with all the other containers I have set up that need DB access) but getting mautic to use it instead of connecting via TCP is being problematic.
I have some config files mounted externally so they will survive a container update and the container has access to the mariadb socket at /run/mysqld/mysql.sock.
What I need to do is to get mautic to use this socket instead so I can isolate the container from the local network.