Openshift MYSQL environment variables not set

蓝咒 提交于 2020-01-03 17:30:19

问题


all my MySQL environment variables result in an empty string such as echo getenv('OPENSHIFT_MYSQL_DB_URL'); echo getenv('OPENSHIFT_MYSQL_DB_HOST');

however the others such as echo getenv('OPENSHIFT_APP_NAME'); echo getenv('OPENSHIFT_REPO_DIR');

work perfectlly fine. Any ideas what i am doing wrong?


回答1:


I had the same issue, and tried creating and recreating Applications multiple times without success

The solution was to use Git to push the code to Openshift (at least one time), if you only use sFTP to push the code, those variables will not be accessible




回答2:


You can just use the rhc app stop & rhc app start commands to restart your application and the environment variables will then be provided to your application. Make sure that you don't just use the rhc app restart command, as it doesn't not usually work, think of it as an apachectl stop/start vs apachectl reload.



来源:https://stackoverflow.com/questions/26831631/openshift-mysql-environment-variables-not-set

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!