Cannot connect to local MySQL server

Hey I’m having some seriously frustrating problems trying to get things sorted so I can develop php and mySQL websites locally for testing.

I’m running Mac OS X 10.4.8
PHP 4.4.4
MySQL 4.1.22-max
Apache 1.3.3
phpMyAdmin 2.9.1.1

Basically, PHP is running fine, and I’ve setup and played around with a database through terminal and through phpMyAdmin. But when I try to connect to the database with a PHP it returns an error EVERY TIME!
//----------
<?php
$connect = mysql_connect(‘localhost’, ‘user’, ‘password’);
?>

returns this error in the browser:

Warning: mysql_connect() [function.mysql_connect]: Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (2) in /Users/One80Admin/lukesturgeon.co.uk/dev/inc/connect.php on line 2
//----------

If you’ve got any thoughts I’d really appreciate it. I’m sure it’s something really simple and obvious.

Could it be to do with the sockets? I have a problem with phpMyAdmin initially until I specifed the path to the socket???