note 97019 added to function.mysql-connect

From: Date: Sun, 28 Mar 2010 21:01:17 +0000
Subject: note 97019 added to function.mysql-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-167468@lists.php.net to get a copy of this message
A point to especially note from the above documentation is that the mysql client library has special behavior around "localhost", in that it will use a socket file instead of TCP/IP. Socket files, while faster, only work if the php script is on the same machine as the database. I found this difficult to overcome when I split off a database server from a server that had a handful of hosted clients all referencing "localhost". After significant effort, and failing with my knowledge of socat and autossh tunnelling as mentioned as a workaround to setup a forward from the socket file to TCP/IP in a mysql forum. I finally resorted to using DNS to reference the DB and no longer provide "localhost". It was a pain to update clients, but live and learn. I tend to work in distributed environments, and now make it a sort of rule of thumb/best practice to use DNS instead of hard coding "localhost" or "x.x.x.x". Hope this helps others out there. Chris Page http://www.chriswpage.com ---- Server IP: 192.41.40.227 Probable Submitter: 71.60.148.210 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php Edit -- https://master.php.net/note/edit/97019 Del: integrated -- https://master.php.net/note/delete/97019/integrated Del: useless -- https://master.php.net/note/delete/97019/useless Del: bad code -- https://master.php.net/note/delete/97019/bad+code Del: spam -- https://master.php.net/note/delete/97019/spam Del: non-english -- https://master.php.net/note/delete/97019/non-english Del: in docs -- https://master.php.net/note/delete/97019/in+docs Del: other reasons-- https://master.php.net/note/delete/97019 Reject -- https://master.php.net/note/reject/97019 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167468) next »