Answer the question
In order to leave comments, you need to log in
mysql_connect() always tries to connect to localhost
mysql_connect('some_host.loc', 'test', 'test);
Gives error Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock
sql.safe_mode is off
Why is it trying to connect through mysql.sock
Answer the question
In order to leave comments, you need to log in
Look through strace/netstat (if you're on Windows, then through procmon/procexp) where PHP actually connects and what happens before, for example, if it tries to resolve the server name.
It's time to punish the use of mysql_ functions. If possible, use PDO.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question