connect to DB in onMessage function
I'm trying to connect to my own (mysql) DB whenever onMessage is fired. Like this:

public function onMessage(ConnectionInterface $from, $msg) {
$con=\mysqli_connect("1xx.xxx.xxx.xxx","root","pass","dbname");
if (mysqli_connect_errno($con))
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$query = "SELECT \* FROM users" or die("Error in the consult.." . mysqli_error($con));
}

Problem is, that I always get error like: 
Fatal error: Call to undefined function mysqli_connect()

So instead I tried using PDO, with similiar results (I get error, that I don't have installed PDO drivers, altough I have)

Note: mysqli and pdo functions are working correctly on my server. I'm using ubuntu, php5, apache. 

I think it has to do something with namespace, maybe composer, but I'm quite newbie to this stuff and don't know where to look. Do you have any suggestion, where could be problem?
