Connect to remote database with php

Connecting through ssh works fine on both servers:

mysql -u user_name -h ip_address -p

Connecting through php only works on the server with the database:

	$db=mysql_pconnect (ip, user, pass) or die (mysql_error());
	mysql_select_db(database,$db);

Any ideas?