douzi0609 2018-06-27 08:41
浏览 82

找不到PHP PDO驱动程序


I have issues with my PHP installation under Ubuntu 16.04 LTS. I am getting the error: the driver is not found 1. I already tried the fix from the following post: PDOException “could not find driver” but it doesn't work. I am running Apache2 with a PHP7.2 Installation. If I run phpinfo() I can see, that it's
"PHP Version 7.2.7-1+ubuntu16.04.1+deb.sury.org+1"
and I can see the PDO extension and the pdo_mysql extension, so theoretically it should find the driver. Both states enabled.

The Script im calling:

<?php
include("sqlconnection.php");
$statement = $pdo->prepare("SELECT * FROM reaktor WHERE reactorID = 1");
$result = $statement->execute();
$return = $statement->fetchAll();
echo json_encode($return);
?>

The sqlconnection.php:

<?php
  $serverName = "nw-system.de";
  $dbName = "openComputers";
  $username = "";
  $passwort = "";
  try{
    $pdo = new PDO("sqlsrv:server=$serverName ; Database=$dbName", $username, $passwort);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  }
  catch(Exception $e)
  {
    exit(print_r($e->getMessage()));
  }
?>


I have deleted the username and password on purpouse

Any Ideas on how to fix this?
Kind regards
Jan

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 mmocr的训练错误,结果全为0
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀