Page 1 of 1

Error Connecting to MySQL through PHP

Posted: Sun Feb 14, 2010 8:43 pm
by tristanhall
Hi,
I am trying to make a person and user management system and I have been successful in developing it locally but whenever I upload it to my web server I get this message:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I host with 1&1 and I have contacted them on the problem. The solution they gave me (take the parentheses off of my 'include' array) did not work. I am confused with this since my Joomla and Wordpress installations communicate fine with the MySQL database (the web host's one, which is the one I am having problems with).
I know it's either a problem with the 'require_once' line:

Code: Select all

<?php require_once('/Connections/Local.php'); ?>
or with the Local.php itself:

Code: Select all

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_Local = "db2264.perfora.net";
$database_Local = "dbo317062752";
$username_Local = "dbo317062752";
$password_Local = "*********";
$Local = mysql_pconnect($hostname_Local, $username_Local, $password_Local) or trigger_error(mysql_error(),E_USER_ERROR); 
?>
Any help is greatly appreciated. The whole program has been uploaded to http://www.lifegoesboom.com/openphoto/
Thanks!
-Tristan

Re: Error Connecting to MySQL through PHP

Posted: Sun Feb 14, 2010 10:48 pm
by Eran
Why are you using mysql_pconnect() instead of mysql_connect()?

Re: Error Connecting to MySQL through PHP

Posted: Mon Feb 15, 2010 11:30 am
by tristanhall
I'm using Dreamweaver to build this so I'm not sure (I know it's not the best to use a WYSIWYG editor). Would it make a difference if I used mysql_connect()?

Re: Error Connecting to MySQL through PHP

Posted: Mon Feb 15, 2010 11:33 am
by tristanhall
I tried mysql_connect() and still got the same problem.