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:
# 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.