After upgrading from ubuntu 14.03 to 16.04. I cannot connect to mysql from php DB. The following code returns
<?php
include_once('DB.php');
$conninfo = "mysql://xxxx:ppppp@localhost/ddddd";
$db = DB::connect($conninfo);
if (DB::isError($db)) {
print $db->getMessage();
exit;
} else {
$result = $db->query("SELECT distinct did from selections where cid=6 order by did DESC;");
while ($result->fetchInto($row, DB_FETCHMODE_ASSOC)) {
extract($row);
print "$did\n";
}
$result->free();
}
$db->disconnect();
?>
DB Error: extension not found.
Note that from mysql, opened from the terminal, I see the contents of the table's column 'did'.
Following the advice of oerdnj from a similar post, I confirm that
- php7.0-mysql package is installed
- mysqli appears in phpinfo. Below is the result of phpinfo | grep mysqli
- and listed below is the output for the ldd command
php -r 'phpinfo();' | grep -i mysqli /etc/php/7.0/cli/conf.d/20-mysqli.ini, mysqli MysqlI Support => enabled mysqli.allow_local_infile => On => On mysqli.allow_persistent => On => On mysqli.default_host => no value => no value mysqli.default_port => 3306 => 3306 mysqli.default_pw => no value => no value mysqli.default_socket => no value => no value mysqli.default_user => no value => no value mysqli.max_links => Unlimited => Unlimited mysqli.max_persistent => Unlimited => Unlimited mysqli.reconnect => Off => Off mysqli.rollback_on_cached_plink => Off => Off API Extensions => mysqli,pdo_mysql
ldd /usr/lib/php/*/mysqli.so linux-vdso.so.1 => (0x00007ffc807a9000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6cde88a000) /lib64/ld-linux-x86-64.so.2 (0x000055a1af509000)
Please help.