Unable to connect to mysql database in scaled OpenShift application

Solution Unverified - Updated -

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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In