If you are getting
mysql_connect() http://function.mysql-connect: 2002 No such file or directory (trying to connect via unix:///tmp/mysql.sock)"
Then you probably need to modify the “mysql.default_socket” value in your /etc/php.
With Mac XAMPP I set it to:
mysql.default_socket = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
in /Applications/XAMPP/xamppfiles/etc/php.ini.
This might be a good time to check the correct php is going to run from the command line, by default it will run the Apple supplied php not the XAMPP one. So I put:
/Applications/XAMPP/xamppfiles/bin
at the top of the /etc/paths file