Take the 2-minute tour ×

I have been given access to a CentOS5 machine by my client for their new site which uses Zend Framework.

phpinfo() states in Configure Command that PDO is disabled ('--disable-pdo'). How can enable it? Do I need to recompile PHP5 to enable it?

I have tried adding 'extension=pdo.so' in php.ini and restarting Apache, but this didn't work.

It would also be nice to understand what '--disable-pdo' actaully means, does it mean it's not compiled into PHP or does it mean its just not enabled?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Not compiled. Install it from your distro's repositories, eg. yum install php-pdo.

share|improve this answer
Ah thanks Yaggo - that installed fine. I notice on my phpinfo() that its only installed for sqlite and not for mysql. Is there another package that needs to be installed to enable this? –  Jake N Mar 23 '10 at 1:05
You need specific driver, try yum search mysql pdo. –  jholster Mar 23 '10 at 8:57
Thought I should follow this up, I used yum install php-pdo Followed by yum install php-mysql The second install for php-mysql failed, saying that my.cnf conflicted. I then restarted Apache and tried again and it worked fine. –  Jake N Mar 25 '10 at 0:08
add comment

While Yaggo's suggestion solves the underlying problem the requester had, in the case where yum is not available (in my case due to painfully restrictive policies by the server administrators), there is a pure PHP library that can bridge the gap called PHPPDO.

It has a couple of caveats, but works pretty well.

  1. You should not extend PHPPDO or the statement object, because that will break the compatibility.
  2. Cursors are not supported.
share|improve this answer
add comment

Your Answer


