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 of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
