Openshift PHP PDO Mysql issue

Permalink
I have uploaded and passed the install test for Concrete 5.7.0.3 going on to the intallation where I put in the database name and login.

Here I am getting an error which has to do with environment variables and I have found the solution, but I do not know where to put this code at. Please help

below link has the solution, if someone with better insight help me connect to the database in openshift

http://www.gitspot.com/2013/04/mysql-database-connection-at-openshi...

 
mhawke replied on at Permalink Reply
mhawke
IMHO, those hoops shouldn't be necessary. Are you committed to Openshift?
SignallHill replied on at Permalink Reply
Yes I would like to use open shift

There is a help section in open shift that talks about this. The link is

https://www.openshift.com/blogs/taking-advantage-of-environment-vari...

At the end it gives the code but is where does it go. Looking at other post in concrete forum I see the place below is the where it should go. But I don't have a clue on how to use it as I don't know php.

'concrete5.7.0.3/concrete/src/Database/Connection/PDOConnection.php

If its a simple fix then please help.
mhawke replied on at Permalink Reply
mhawke
Well, you shouldn't make changes to the files inside the root/concrete folder because all your changes will be destroyed when you upgrade concrete5 to a new version. Other experts on Stack Overflow also suggest moving to a new host. PDO is a basic requirement of a secure server so I wouldn't mess around with trying to cobble something together.

http://stackoverflow.com/questions/3723992/how-do-i-enable-pdo-exte...
SignallHill replied on at Permalink Reply
Thanks. ok I will look for other hosts.

Since I am abandoning this one what would the code look like if I were to change PDOconnections.php, just curious.

Here is the code thats need to be input

define('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST'));
define('DB_PORT',getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_USER',getenv('OPENSHIFT_MYSQL_DB_USERNAME'));
define('DB_PASS',getenv('OPENSHIFT_MYSQL_DB_PASSWORD'));
define('DB_NAME',getenv('OPENSHIFT_GEAR_NAME'));

$dsn = 'mysql:dbname='.DB_NAME.';host='.DB_HOST.';port='.DB_PORT;
$dbh = new PDO($dsn, DB_USER, DB_PASS);
mhawke replied on at Permalink Reply
mhawke
Sorry, I have no clue. I've never played around with it. I have no time for curiosity unless it's leading me somewhere fruitful.
SignallHill replied on at Permalink Reply
The new update solved it. I should not have wasted my time here.
mhawke replied on at Permalink Reply
mhawke
Sorry pshakya, I didn't mean to sound flippant or disrespectful of your curiosity. Sometimes pure text messages cannot express things properly. I should have been more careful. I'm glad the most recent version solved your issue.