<?php use Doctrine\Common\ClassLoader; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Configuration; require 'Doctrine/Common/ClassLoader.php'; $classLoader = new ClassLoader('Doctrine', '/www/DoctrineDBAL-2.3.4/'); $classLoader->register(); $config = new Configuration(); $connectionParams = array( 'dbname' => 'test', 'user' => 'www', 'password' => 'passw0rd', 'host' => '192.168.2.1', 'driver' => 'pdo_mysql', ); $conn = DriverManager::getConnection($connectionParams, $config); $sql = "SELECT * FROM members limit 5"; $stmt = $conn->query($sql); while ($row = $stmt->fetch()) { printf("%s\r\n", $row['username']); }