Jump to content

Recommended Posts

Hi!

I try to do a little Consoleapp with PHP.

The problem is, when I try to connect to the local MySQL-Server, I get this errormessage:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2) in /Sites/mubix/library/database.php on line 6

That's the file where I try to connect:

<?php
require_once dirname(__FILE__).'/../settings/database.php';

global $__db__;

$dbc = mysql_connect($__db__['host'], $__db__['user'], $__db__['password'],);
if ($dbc !== false) {
	mysql_select_db($__db__['database']);
}else die("Error: Could not connect to database\n");
?>

$__db__['host'] contains localhost

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.