Codeigniter database connection over SSH |
[eluser]clustersblue[/eluser]
I saw several post regarding this topic (as per reference) on trying to connect to the database using SSH library specifically phpseclib, but those were already a year old without resolutions. This might be related to them on most part but I decided to open up new thread for my concern. I wanted to connect to a MySQL server on a linux machine using codeigniter's own database library. Normally, I can use CI database library directly without a problem. But this time, I was told that I need to authenticate first with the server before MySQL authentication. Indeed, when I tried it this is what I got: Code: Unable to connect to your database server using the provided settings I tried to connect to the database using MySQL Workbench and I noticed that I can connect to it using Standard TCP/IP over SSH connection method. On my research I can do SSH connection in PHP using libraries. I found phpseclib as it is most talk about and I did able to successfully created a connection using that library. Below is my example code. Code: set_include_path(get_include_path() . PATH_SEPARATOR . APPPATH . 'libraries/phpseclib'); Now, after verifying that it was successful I tried to load my database group (in Blue), thinking it will inherit the connection but it failed. Code: set_include_path(get_include_path() . PATH_SEPARATOR . APPPATH . 'libraries/phpseclib'); And my database config: Code: $db['local_dss_db']['hostname'] = "xxx.xxx.xxx.xxx:22"; I got this error instead. So, clearly it didn't inherited the connection. Code: Unable to connect to your database server using the provided settings I'm not sure if my assumption above is correct or is there another way to do this. I wish I could make it work for I need to use GroceryCRUD that relies on CI native database library. I'm open to any other way as long as I will be able to use both GC and CI. Any help, suggestions, references are much appreciated. -thanks Reference to other blog related to this: http://ellislab.com/forums/viewthread/237873/#1058767 http://ellislab.com/forums/viewthread/138094/#681151 http://ellislab.com/forums/viewthread/93924/#475457 |
Messages In This Thread |
Codeigniter database connection over SSH - by El Forum - 07-16-2014, 01:38 AM
Codeigniter database connection over SSH - by El Forum - 07-16-2014, 07:25 AM
Codeigniter database connection over SSH - by El Forum - 07-18-2014, 07:29 AM
Codeigniter database connection over SSH - by El Forum - 08-04-2014, 10:24 PM
Codeigniter database connection over SSH - by El Forum - 08-05-2014, 07:20 AM
|