Cannot connect to server
Posted by jill (jill), 9 April 2003I am very stuck and would greatly appreciate any help.
We have two servers and up to today I have been able to connect to them fine though the connection code is different for the two servers. Also I sometimes connect in the shell of SSH, and sometimes in php pages.
Connection code for the first server is as follows (where username and password are replaced as appropriate):
In the shell:
mysql -h localhost --socket=/tmp/mysql.sock2 -u username -p password
$dbh = mysql_connect("localhost:/tmp/mysql.sock2", "username", "password");
Connection code for the second server is:
In the shell:
mysql -h localhost --socket=/var/lib/mysql/mysql.sock -u username -p password
$dbh = mysql_connect("localhost:/var/lib/mysql/mysql.sock ", "username", "password");
Now the last of these has stopped working, and I cannot see why.
On the second server I can connect in the shell as shown above, but when I try to connect in the php code with the same uname and pword I get the error message
Warning: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (111) in /home/www/adminoffice/public_html/hold/erfn/erfncreate.php4 on line 31
Any suggestions as to what might have gone wrong would save my sanity
Posted by admin (Graham Ellis), 9 April 2003Question - what changed at the time it stopped working? Was a new version of MySQL (4.0.12 production came out recently) or PHP (There's a 4.3.2 Release Candidate around) installed? Were any other configurations changed?
Nothing shouts at me as obvious ... if sql.safe_mode has been enabled, the PHP user name and password you give are ignored; connection attempted as the user name under which PHP is running, no password. A long shot, but has someone reconfigured the PHP and thought that enabling a "safe mode" woul dbe a good idea
Posted by jill (jill), 10 April 2003Thanks for the reply. It seems to be sorted now - I still do not know what was going wrong, I cannot see a mistake in the code - but probably my fault somewhere along the line.
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho