title: Connect to a mysql database via SSH through PHP
body: <p>I have already written a php file that connects to the mysql database locally. Now, I want to connect to a remote database via SSH. Currently the connect function for my database is the following in php: </p>
  
  <pre><code>$this-&gt;db = new mysqli(_SERVR_URL, _SERVR_USER , _SERVR_PASS, _SERVR_DB);
      if ($this-&gt;db-&gt;connect_errno) {
          echo "Failed to connect to MySQL: (" . $this-&gt;db-&gt;connect_errno . ") " . $this-&gt;db-&gt;connect_error;
      }
      else{
          //echo "Successfully connected!! &lt;BR&gt;&lt;BR&gt;";
      }
  </code></pre>
  
  <p>I want to only change the connect function (above) so that the rest of the code still works. I have successfully installed the phpseclib and am not interested in installing php's ssh extensions because those were not working after nearly 5 hours of effort. The phpseclib is working, and I think this because when I use require it does not die. </p>
  
  <p>However, when I try to start working with the ssh stuff, it throws a server error:</p>
  
  <pre><code>$ssh = new Net_SSH1(myURL);
  </code></pre>
  
  <p>The way that I usually SSH into my server is with a .pem file. Can I get some guidance on:</p>
  
  <ol>
  <li>Why the current code may be throwing an error?</li>
  <li>If this is possible.</li>
  <li>How would you write the connection code with the .pem file. </li>
  </ol>