I seem to be getting a 503 with any attempts to access my DB. I am using env variables as per documentation:
define('DB_SERVER', getenv('OPENSHIFT_MYSQL_DB_HOST'));
define('DB_PORT',getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_USER',getenv('OPENSHIFT_MYSQL_DB_USERNAME'));
define('DB_PASSWORD',getenv('OPENSHIFT_MYSQL_DB_PASSWORD'));
define('DB_NAME',getenv('OPENSHIFT_GEAR_NAME'));
$link = new mysqli(DB_SERVER,DB_USER,DB_PASSWORD);
if ($link->connect_errno) {
die('Connect Error (' . $link->connect_errno . ') '
. $link->connect_error);
}
mysqli_select_db($link, DB_NAME);
The only result I get is a 503 there is nothing in the logs to indicate any issues but then again I'm not sure if I need to do any config of the logs on openshift to expose that. I'm new to this service.
update: The cause of the 503 is ambiguous. At the moment I get it if my index is:
<?php session_start(); ?>
<?php require_once('lib/resources/config.php'); ?>
and my config.php starts with:
<?php die('test');
I'm killing it right at the top of the include file so it's not my code, something else must be crashing, how do I figure it out?
So after more research I determined the issue. With open shift if you use:
rhc tail appname
It gives you the errors actually causing the issues. In my case it was a syntax error further down the code.