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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content