php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13466 Errors when using variables as the host parameter
Submitted: 2001-09-27 08:20 UTC Modified: 2001-10-01 22:59 UTC
From: neil dot walker at syntegra dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.6 OS:
Private report: No CVE-ID: None
 [2001-09-27 08:20 UTC] neil dot walker at syntegra dot com
If I do:

$user="frank";
$pwd="skinner";
$db="db.cp-productions.f2s.com:walkern";

The following works fine:
$conn = mysql_connect("db.cp-productions.f2s.com:walkern", $user, $pwd); 

If I do:
$conn = mysql_connect($db, $user, $pwd); 

The following error occurs:
Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /web/sites/253/walkern/www.cp-productions.f2s.com/inc/news.php

I think it's something to do with the ':walkern' bit.  It works ok on my other site where I have $user="localhost".

I've tried putting it in quotes, etc.


I have tried it on a 4.06 and a 4.01 build (different ISP's) and both do the same.

Neil.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-27 08:25 UTC] neil dot walker at syntegra dot com
If I do:

$user="frank";
$pwd="skinner";
$db="db.cp-productions.f2s.com:walkern";

The following works fine:
$conn = mysql_connect("db.cp-productions.f2s.com:walkern", $user, $pwd); 

If I do:
$conn = mysql_connect($db, $user, $pwd); 

The following error occurs:
Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in
/web/sites/253/walkern/www.cp-productions.f2s.com/inc/news.php

I think it's something to do with the ':walkern' bit.  It works ok on my other site where
I have $db="localhost".

I've tried putting it in quotes, etc.


I have tried it on a 4.06 and a 4.01 build (different ISP's) and both do the same.

Neil.



 [2001-10-01 22:59 UTC] sniper@php.net
RTFM: http://www.php.net/manual/en/function.mysql-connect.php

The 'walkern' part is assumed to be port/unix socket path.

--Jani

 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 04:03:45 2023 UTC