强制php使用tcp而不是socket而不将mysql主机从localhost更改为127.0.0.1

is there any way to force php to use a TCP connection instead of the socket file for local mysql connections without changing the host parameter from "localhost" to "127.0.0.1"?

Scenario:

Up to now Apache/php and MySQL are on the same server. But for performance and high availability reasons I'm planing to relocate MySQL to another server. The new server will be replicated to a failover server. On the Apache/php server I want to use haProxy (tcp) for the connection handling. For data protection reasons I can't change the host parameter from "localhost" to "127.0.0.1".

Workaround:

The only solution I found is a workaround with socat:

socat UNIX-LISTEN:/path/to/mysql.sock,fork,user=mysql,group=mysql,mode=777 TCP:127.0.0.1:3306 2> /dev/null &"

Is there any other way?