Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

PDO problem

Discussion in 'EasyApache' started by mehnihma, Apr 6, 2014.

  1. mehnihma

    mehnihma Well-Known Member

    Joined:
    Dec 15, 2012
    Messages:
    57
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Hi
    I am having problem activating PDO in PHP, I have recompiled with easyapache and it is loaded in php

    But when I try to connect to database it gives me error: could not find driver

    this is the script:
    <?php
    $hostname = "localhost";
    $username = "example";
    $password = "password";

    try {
    $db = new PDO("mysql:host=$hostname;dbname=ibaza", $username, $password);
    echo "Connected to database";
    }
    catch(PDOException $e) {
    echo $e->getMessage();
    }

    ?>

    I have recently updated MySQL to 5.6 and not sure why this happens. PDO is not working?



    can you maybe help me?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #1 mehnihma, Apr 6, 2014
    Last edited by a moderator: Apr 7, 2014
    mauroya33 likes this.
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,704
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you upload a PHPINFO file to see if the PDO module for PHP is loaded properly? Also, does installing it as a PECL module make a difference? EX:

    Code:
    pecl install PDO_MySQL
    Note: It looked like you posted the actual username/password combination used in your script configuration file. I updated it to use example entries, but if you did initially use the actual credentials, please consider those details exposed because this is a public forum.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice