Installing PDO_MYSQL on PHP 5.1.6 using PECL OS: Ubuntu

15,049

If you're on ubuntu, try apt-get :

sudo apt-get install php5-mysql

which should make

/usr/lib/php5/20060613+lfs/pdo.so

and PDO will be available after an apache restart

Share:
15,049
Ben Waine
Author by

Ben Waine

London based PHP contractor. Interested in all things web - specifically PHP, Node js and Javascript.

Updated on June 24, 2022

Comments

  • Ben Waine
    Ben Waine almost 2 years

    I'm having real problems getting PDO_MYSQL working.

    I started by just trying to install the PDO_MYSQL driver via PECL, however when this didn't work I looked round to see if there where any issues reported. It seems that there may be a conflict between the embedded version of PDO and PDO_MYSQL. To that end i decided to reinstall all it's dependencies from PECL.

    Environment:

    OS: Ubuntu
    PHP Ver: 5.1.6 (Unable to upgrade due to clients live environment)

    Procedure Followed:

    PECL uninstall PDO_MYSQL
    PECL uninstall PDO
    PECL uninstall mysql
    PECL install mysql
    PECL install PDO
    PECL install PDO_MYSQL
    
    Lines Added to PHP.ini
    extension=mysql.so
    extension=pdo.so
    extension=pdo_mysql.so
    
    apachectl restart
    [warn] php5_module is already loaded, skipping
    

    I then check PHPINFO to see which modules are installed. I see:

    PDO drivers     sqlite2 
    

    That's it!

    If any one could suggest any solutions to this I'd be deeply grateful. I need MYSQL PDO driver to run zend framework for an upcoming project... and yes I have to use v1.6 due to the PHP version.

  • jared
    jared almost 15 years
    DEFINITELY use apt-get or aptitude. The whole advantage of using a popular distro, like Ubuntu, is that you manage all your software in one place. PEAR/PECL are more for Windows people, who are on their own with software management.
  • Ben Waine
    Ben Waine almost 15 years
    I've discussed your suggested solution with the blioke in charge of our staging server (were the problem is occuring). He says that PHP was manually compiled and configured to exactly match the enviroment on our clients servers. He thinks may mean that apt-get is affecting UBUNTU's standard PHP release and not our custom version. Any thoughts? Thanks for taking the time to respond.