Article ID: 2401, created on Oct 29, 2007, last review on May 9, 2014

  • Applies to:
  • Pro Control Panel Linux

AdditionalInformation

View Knowledge
Knowledge ID 1163
Product : WEBppliance for Linux
Version : 3.5.4
Topic : FAQ

Title
PHP/MySQL connectivity for High Security Sites

Summary
PHP/MySQL connectivity for High Security Sites

Prevention


Details
Solution:

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.


Attachments


Related Knowledge

Related Links
 
Last ModifiedUsageSatisfiedLast Used
8/20/2004 12:42:26 PM55 10/11/2007 6:27:57 AM

4cc899da08664637a8bc437308d3ddd7 3ccb419cf98083f3bb45808fba8dbc7c 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF