I have an API I want to deploy to OpenShift, everything works locally, but when trying to use it online I get some problems.
When trying to connect to the database, using PDO, I get this error:
Failed to connect to the database: SQLSTATE[HY000] [2002] Connection refused
I have the database set up correctly, and I have the correct details for the connection (I'm pretty sure).
My code:
$username = "myuser";
$password = "lmnop";
$host = "127.0.0.1";
$dbname = "loginapi";
$port = "3306";
$db = new PDO("mysql:host={$host};port={$port};dbname={$dbname};charset=utf8", $username, $password, $options);
Why is OpenShift not allowing the connection?