Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

extension=mysql.so
extension=pdo.so
extension=pdo_mysql.so
extension=gd.so
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

2 Answers 2

up vote 2 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

 
discard

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.