Mysql variables are not shown for a php application

Solution Verified - Updated -

Issue

  • We have a php application and added a mysql cartridge, when we try to print the environment variables using var_dump($_ENV); or phpinfo();, mysql related variables are not printed :
OPENSHIFT_MYSQL_DB_HOST 
OPENSHIFT_MYSQL_DB_PORT 
OPENSHIFT_MYSQL_DB_USERNAME 
OPENSHIFT_MYSQL_DB_PASSWORD 
OPENSHIFT_MYSQL_DB_SOCKET
OPENSHIFT_MYSQL_DB_URL

However when we ssh to application and run env command those variables are present.
- Environmental variables for mysql database not working in application.
- getenv('OPENSHIFT_MYSQL_DB_HOST') empty from php code.
- MySql env variables are returned empty values in Openshift.

Environment

  • OpenShift Online (OSO)
  • OpenShift Enterprise (OSE)
    • 2.0
    • 1.2

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
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.