Lumio Posted October 16, 2007 Share Posted October 16, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/73448-cant-create-connection-with-php-on-terminal/ Share on other sites More sharing options...
Lumio Posted October 16, 2007 Author Share Posted October 16, 2007 Someone here who could help me? Quote Link to comment https://forums.phpfreaks.com/topic/73448-cant-create-connection-with-php-on-terminal/#findComment-370652 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.