error in connection between mysql and php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

error in connection between mysql and php

Post by amirbwb »

Hello, I have created a software on my localhost ... but i uploaded it to my friend server, it shows me an error:


Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /hermes/bosweb25c/b1151/nf.lebanonline/public_html/medi-school-net/emp/medcon/medcon.php on line 6

Fatal error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /hermes/bosweb25c/b1151/nf.lebanonline/public_html/medi-school-net/emp/medcon/medcon.php on line 6

medcon.php (the connection to mysql)

Code: Select all

<?php
$hostname_connection = "localhost";
$database_connection = "***************";
$username_connection = "**********";
$password_connection = "************";
$connection = mysql_pconnect($hostname_connection, $username_connection, $password_connection) or trigger_error(mysql_error(),E_USER_ERROR);
?>
************** for privacy only =)


why it is giving me this error ???? it worked fine on my localhost and my free domain at amir.comoj.com/najla
Last edited by Benjamin on Mon Nov 14, 2011 10:58 pm, edited 1 time in total.
Reason: Added [syntax=php||htm||css||javascript||sql||etc] - Please use [syntax] tags when posting code in the forums! Thanks.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: error in connection between mysql and php

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

Re: error in connection between mysql and php

Post by amirbwb »

thank you but am searching for sock(2) not sock(38) ... and my friend is hosting with a company he have no access to directories in server, only he can upload to public/
so should he contact the company or what to do ?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: error in connection between mysql and php

Post by social_experiment »

amirbwb wrote:so should he contact the company
Yeah. If neither of you have any experience with running webservers or don't run the webserver yourself it's best to ask whoever is hosting your site.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
amirbwb
Forum Commoner
Posts: 89
Joined: Sat Oct 30, 2010 6:10 pm

Re: error in connection between mysql and php

Post by amirbwb »

mm ok thank you very much ... I will
Post Reply