trying to install wordpress on osx mavericks (with built-in apache+php and homebrew mysql).
mysql -u root # connects php -r 'var_dump(mysql_connect("localhost", "root", ""));' # doesn't connect
web-searching revealed that mysql connects to 'localhost' via a unix socket, but connects to loopback ip 127.0.0.1 via a network socket.
php -r 'var_dump(mysql_connect("127.0.0.1", "root", ""));' # connects!
why can't i connect to mysql via localhost from php??