How enable pdo_mysql

47,691

Install pdo:

yum install php-devel php-pear mysql-devel httpd-devel
pecl install pdo
PHP_PDO_SHARED=1 pecl install pdo_mysql

Then edit the /etc/php.ini file with your favorite commandline texteditor (vi, vim, nano,...) (access the machine through ssh) and add these lines:

extension=pdo.so
extension=pdo_mysql.so

Restart the webserver and you should be all set. Cudos to http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/

Share:
47,691
hvalner
Author by

hvalner

Updated on September 18, 2022

Comments

  • hvalner
    hvalner over 1 year

    I am trying to install SpaceBukkit. I was wondering how I enable pdo_mysql. When trying to setup the MySQL part I get this error:

    The "pdo_mysql" extension is NOT loaded in your `php.ini`! 
    Make sure to load it before continuing!
    

    This is not a cPanel server, so I can only rely off of ssh and ftp (sftp). If you guys could please let me know it would be greatly appreciated!

    As a side note, I am on Centos 5.

  • hvalner
    hvalner over 11 years
    Where do I add the: extension=pdo.so extension=pdo_mysql.so Where in the file?
  • Lucas Kauffman
    Lucas Kauffman over 11 years
    at the end or wherever extension is defined.
  • hvalner
    hvalner over 11 years
    What do you mean wherever the extension is defined?
  • Lucas Kauffman
    Lucas Kauffman over 11 years
    Have you even tried opening the php.ini file?
  • hvalner
    hvalner over 11 years
    Yea I have. Just I don't know where to add it. Sorry bout that.
  • mika
    mika over 9 years
    What about 'WARNING: "pecl/PDO" is deprecated in favor of "channel://svn.php.net/viewvc/php/php-src/trunk/ext/pdo//ext‌​/PDO"' ? The link you provide is very old...