I'm adding PHP (php-fpm) to an existing Nginx Ubuntu 10.04 server and can't get pdo_mysql to work. I'm trying to connect to a MySQL server someplace else, but all the Googling answers I found are in regards to MySQL not working on the local server, so I'm not sure how to proceed.
I don't have mysqld installed, so I'm not sure if I need it, or if there's a way around this? Also I'm wondering if it can't create mysqld.sock because there is mysql user on the server?
Error:
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Fatal error: Call to a member function query() on a non-object
My PHP connection code:
$this->PDO = new PDO('mysql:host=' . $this->config->getValue('db_host') .
';dbname=' . $this->config->getValue('db_name'),
$this->config->getValue('db_user'),
$this->config->getValue('db_pass'));
My Query line it fails on:
$PDOStatement = $this->PDO->query($query);
Appreciate any help, thanks.