I want to run a php script using command line in Ubuntu (command: php /var/www/test.php), it runs ok in browser (url: http://example.com/test.php), but when running in command while pdo tried to connect to mysql, exception "could not find driver" was thrown, I checked the including paths everthing is correct, could somebody please help me about this?
code is very very simple:
<?php
$username = "root";
$pwd = "test";
try {
$pdo = new PDO("mysql:host=localhost;port=3306;dbname=db", $username, $pwd, [PDO::ATTR_PERSISTENT => true]);
} catch (PDOException $e) {
die("Connect Error Infomation:" . $e->getMessage());
}