I have been working on my site, and incorporating PHP and MySQL into it, including developing my own Blog Script.
I have been able to connect to the database fine, if I put the mysql_connect in the same file that is using the database, but I’m having one issue.
When I put the connection (same as when in the other file, I tripple checked this), code into an outside file, and include that via include_once, then call a function (I.E: dbConnect(); ) it errors out, saying it cannot connect to the mysql server.
Exact Error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
As I said, I didn’t change any of the actual connection code, I just put it in another file (db.inc.php), and included that file. Most sites I have read, say this is the way to do this.
Does anyone know what the issue is, or if Dreamhost might just have some sort of protection against this for some reason or another?
Craig (Abyss, -vI-)