2

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
1
  • 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, 2011 at 23:14

2 Answers 2

3

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.

1
  • I use nginx. The /etc/php5/conf.d directory is empty.
    – user39618
    Dec 13, 2011 at 14:05
0

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.

1
  • That shouldn't be needed for 5.3.6. PDO should be part of the the standard php-mysql package.
    – Zoredache
    Dec 12, 2011 at 23:15

You must log in to answer this question.