Welcome Guest, Not a member yet? Register   Sign In
Mysql Alternate port
#11

[eluser]percent20[/eluser]
I actually did try that and for some reason it didn't work as I assumed it was using mysql_connect but because I didn't know how the CI framework handled it when it didn't work I just figured CI did something hinky with the information and what I added was malformed.

I did however go against the advise just out of pure curiosity because I need to figure out how CI works under the hood and got a solution to work with 2 lines adding it to 2 places.

mysql_driver.php - Before
Code:
function db_connect()
{
    return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);
}


mysql_driver.php - After
Code:
function db_connect()
{
    $port = ($this->port == '') ? '' : ":".$this->port;
        
    return @mysql_connect($this->hostname.$port, $this->username, $this->password, TRUE);
}

And I did that to db_pconnect() function too.

So now it can use the $db['defualt']['port'] = "portnumber"; just fine

edit: I did a little revision looking and it looks like i typed in the hostname wrong when I originaly tried to do the port so it was my bad. Hopefully this will be a non-issue in the future as it can be done both ways.
#12

[eluser]Randy Casburn[/eluser]
Please check the bug report I submitted on this topic. If you are going to do that, you'll also need to do it in the db_pconnect function as well. I actually wrote out the if statement rather than use the shorthand method while concatenating the colon. Either way works.

I'm sure the official fix will come and this will be made permanent eventually. I think hacking the core in the case is a fairly safe bet and you'll be ok. You need to make a note in text file in the root of your CI directory structure. I call mine MODIFICATIONS(.txt) or whatever and I document all the customizations I've done to the core or any weird things I've done. That way, if I ever forget or can't figure out why something won't work, I look there to make sure I have strangled myself first.

I was going to tell you all this...you just beat me to the punch. Glad you got it going.

Randy




Theme © iAndrew 2016 - Forum software by © MyBB