Re the command-line client, you probably need to explicitally tell it use tcp
mysql -P 9306 --protocol=tcp
Its counter-intutive, that the mysql client will silentiy ignore the -P param, if it finds a mysql server on the local machine.
And as for PHP, no idea if what you have should work, but I tend to use
$sphinx = new mysqli("127.0.0.1", "", "", "", 9306);
which works for me.