The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    6
    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?
     
    #1 mehnihma, Apr 6, 2014
    Last edited by a moderator: Apr 7, 2014
    mauroya33 likes this.
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    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.
     
Loading...

Share This Page