Jump to content


Photo

Pear connecting to mysql using a different socket


  • Please log in to reply
2 replies to this topic

#1 peyups

peyups
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationPhilippines

Posted 24 July 2003 - 10:23 AM

hi all,

m currently using the PEAR module of php4.06 on top of redhat. Our provider implemented a new installation for mysql wherein the mysql.sock file was created in another directory instead of the default (\'/tmp/mysql.sock). Using mysql_connect, this was achieved using localhost:/path/to/socket but this could not be achieved using pear class ; DB::connect(\"mysql://$dbuser:$dbpass@$dbhost:/path/to/socket/$dbname\"). I\'ve tried enclosing it in single quotes etc... it can\'t connect to that socket i think because of the forward slash (/). Any ideas? couldn\'t change the location of the mysql sockets coz we are only hosting it their.

All help would be very much appreciated.

thanks

#2 barbatruc

barbatruc
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationMontreal, Quebec, Canada

Posted 25 July 2003 - 04:51 PM

In the doc of PEAR :: DB, there is the following example:
Connect to database through a socket:mysql://user:pass@unix(/path/to/socket)/pear
So basically, in your case you would have:
mysql://$dbuser:$dbpass@tcp(/path/to/socket:port):/$dbname"
Hope this helps.

JP.
Unfortunately, PHP \'empowered every moron with a copy of Windows notepad to be \"web programmers\". (...) Give PHP a real INFRASTRUCTURE. Use PEAR!!!\'

#3 peyups

peyups
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationPhilippines

Posted 28 July 2003 - 03:03 AM

thanks bro...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users