Unable to connect to mysql database in scaled OpenShift application
Issue
- In a scaled OpenShift Online application, the mysql database cannot be accessed through php. The following code is used:
$dbhost = getenv("OPENSHIFT_MYSQL_DB_HOST");
$dbuser = getenv("OPENSHIFT_MYSQL_DB_USERNAME");
$dbpwd = getenv("OPENSHIFT_MYSQL_DB_PASSWORD");
$connection = mysql_connect($dbhost, $dbuser, $dbpwd);
Environment
- OpenShift Online
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.