Installing PDO_MYSQL on CentOS (the easy way)
When deploying LAMP projects, quite often we find ourselves being given access to a newly installed server with distribution-specific default configurations, which are usually very stripped down. Our Carbon Content Management Toolkit, which runs on top of the Zend Framework, uses the PDO_MYSQL driver for data access, along with a few other modules that are typically present in commercial hosting environments, but not always included in an OS’s default PHP build.
Getting PEAR, PECL, and a build environment set up can be a time consuming process if you do it from scratch. Luckily most OSs these days come with easy to use package management systems that take care of downloading, building, and installing the packages you need, and their dependancies.
Check the package management system entry on Wikipedia if you’re unsure about which package system your OS uses. Each one works a little bit differently, but the concepts are the same. You’re going to need to set up your OS’s version of the following packages in order to make your life easy:
The package names will differ a bit for each system. The following example uses the Yum package manager in CentOS, and gets PDO_MYSQL up and running in just a few minutes.
# yum install php-devel php-pear mysql-devel httpd-devel
# pecl install pdo
# PHP_PDO_SHARED=1 pecl install pdo_mysql
Add these lines to php.ini:
Now restart Apache, and you should see your PDO modules in phpinfo(), Robert’s your father’s brother.
# apachectl restart
If you need to actually make a custom PHP build, you should have everything you need to do that after installing the devel packages. You still may need to build any dependancies that your custom PHP build requires, but your package system should make that fairly easy.
[…] eCommerce cart and it’s requiring PDO_MYSQL to be installed, so I followed the directions of this site which shows how to do it using pecl, and followed it to the letter, but now whenever I include […]
[…] from: http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/ […]
[…] paket pdo_mysql di Centos http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/ […]
[…] any future Googlers with a similar problem: http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/ […]
[…] на оригинал статьи по установке pdo_mysql на […]
[…] You've been Stumbled! […]
Thanks a lot.
Your tip was very important for me.
Thank you very much. This helped me.
I did’n need to put in the extensions into my php.ini, it was precopiled with it.
You save my day. I was about to recompile whole php because the pdo_mysql was disable in CentOS5 by default on Godaddy VPS server and magento commerce need this library. Than I found your post and it worked for me .. Thank you,
[…] Restart the webserver and you should be all set. Cudos to http://karoshiethos.com/2008/07/24/installing-pdo_mysql-on-centos/ […]