title: database connection with OPENSHIFT
body: <p>i am try to connect phpmyadmin database using my php script in OPENSHIFT<br>
  <a href="https://www.openshift.com/blogs/using-filezilla-and-sftp-on-windows-with-openshift" rel="nofollow">i am using sftp to upload file in openshift</a>
  <br>
  doing this for connection <br></p>
  
  <p><strong>index.php</strong>
  <br></p>
  
  <pre><code>&lt;?php 
   try {
                  require_once 'conf.php';
                  $conn = mysqlConnector();
                  $stmt = $conn-&gt;prepare('SELECT * FROM demo');
                  $stmt-&gt;execute();
  
                  while($row = $stmt-&gt;fetch()) {
                          print_r($row);          
                  }
  
  
          } catch(PDOException $e) {
                  echo 'ERROR: ' . $e-&gt;getMessage();
          }
  
  ?&gt;
  </code></pre>
  
  <p><strong>conf.php</strong></p>
  
  <pre><code>&lt;?php
  define('DB_HOST', getenv('127.*.**.*'));
  define('DB_PORT',getenv('****')); 
  define('DB_USER',getenv('admin4*****'));
  define('DB_PASS',getenv('databasePassword'));
  define('DB_NAME',getenv('ssh://5348030a***************@landbayscaling-innovifytest.rhcloud.com/~/git/landbayscaling.git/'));
  
  function mysqlConnector(){
      $dsn = 'mysql:dbname='.DB_BASE.';host='.DB_HOST.';port='.DB_PORT;
      $dbh = new PDO($dsn, DB_USER, DB_PASS);
      $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      return $dbh;
      }
  ?&gt;
  </code></pre>
  
  <p><a href="http://landbayscaling-innovifytest.rhcloud.com/" rel="nofollow">Url Of Opensift</a></p>
  
  <p>Error is this:-<br></p>
  
  <p><strong>ERROR: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)</strong></p>