Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have PHP 5.3.6 and I use ubuntu.

How can I enable/install PDO and GD Extensions. I have already tried installing php5-mysql and php5-gd. I have also tried adding this into my php.ini:
share|improve this question
Did you install php-cgi from the standard repositories? If so, then it should have just worked. Which php.ini did you check? – Zoredache Dec 12 '11 at 23:14
up vote 3 down vote accepted

All you should be needing to do is:

apt-get install php5-gd php5-mysql

You should not need to edit anything else, This should cause the extension= stuff to be added to /etc/php5/conf.d files which will automatically be included.

Check the output of the phpinfo() function to see if the modules are enabled or not. Note that although you shouldn't need to edit them, there are separate php.ini files for apache2/cli/cgi in, for example, /etc/php5/apache2/php.ini

If your /etc/php5/conf.d directory is empty, and those packages are already installed, someone must have deleted files from there, in order to get apt to restore them, run:

apt-get -o DPkg::Options::='--force-confmiss' reinstall php5-gd php5-mysql

The reason you'd have to do this, is that dpkg assumes that if you deleted conffiles, you did it for a reason, and it doesn't want to revert your change.

share|improve this answer
I use nginx. The /etc/php5/conf.d directory is empty. – Ragnis Dec 13 '11 at 14:05

install php5-dev and php-pear, then you should be able to install pdo_mysql via pecl install pdo_mysql. The lines in php.ini should be added automatically.

share|improve this answer
That shouldn't be needed for 5.3.6. PDO should be part of the the standard php-mysql package. – Zoredache Dec 12 '11 at 23:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.