Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

PDO : Uncaught PDO exception: could not find driver #65

@StephenKirwin

Description

@StephenKirwin

I used this layer to create a PHP lambda API. I then tried to create a PDO and connect it to a MySQL database. I got the following error
"Uncaught PDOException: could not find driver in /var/task/index.php"

My php.ini file contains the following:
extension=json.so
extension=mysql.so
extension=pdo_mysql.so
extension=pdo.so
extension=php_pdo_mysql.dll
extension=pdo_mysql.dll

Here is my index.php code for creating the DB
$conn = null;

$conn = new PDO('mysql:host=' . $host . ';dbname=' . $db_name, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions