Error Connecting to MySQL through PHP

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tristanhall
Forum Newbie
Posts: 11
Joined: Sun Feb 07, 2010 6:12 pm

Error Connecting to MySQL through PHP

Post 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
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Error Connecting to MySQL through PHP

Post by Eran »

Why are you using mysql_pconnect() instead of mysql_connect()?
tristanhall
Forum Newbie
Posts: 11
Joined: Sun Feb 07, 2010 6:12 pm

Re: Error Connecting to MySQL through PHP

Post 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()?
tristanhall
Forum Newbie
Posts: 11
Joined: Sun Feb 07, 2010 6:12 pm

Re: Error Connecting to MySQL through PHP

Post by tristanhall »

I tried mysql_connect() and still got the same problem.
Post Reply