0

Im having the hardest time with this. Im doing a simple select statement in php through terminal. I can run this script in my browser by refreshing the page just fine. But when i type

php test.php

on the terminal, it returns

Warning: mysqli_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)

I dont think theres anything wrong with the script itself, but im not sure what the error message is telling me or what i should do about it. Thanks1

Ben
  • 1,173
  • 2
  • 13
  • 17

1 Answers1

0

Try host 127.0.0.1 instead of localhost or pass absolute path to the mysql.sock:

$port = '/path/to/mysql.sock';
Londeren
  • 2,764
  • 21
  • 26