The following applies for high security sites on WEBppliance 3.5.0 and above
For high security sites, PHP scripts are run as CGI, and are chrooted into the respective site's filesystem.As a result, any connection to MySQL databases must go through the TCP port 3306, and not via. the /var/lib/mysql/mysql.sock socket file.
Hence, a PHP script in a high security site should connect to a mysql database as follows:
$DBconnect = mysql_connect ('127.0.0.1:3306', <username>, <password>) or die (mysql_error());
Also note that 127.0.0.1 must be specified in the connection string. If you specify localhost or localhost.localdomain, then the MySQL client library will override this and try to connect to the local socket /var/lib/mysql/mysql.sock, which will result in an error. This is a known issue with MySQL.