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
  • 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 Answers2

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.

stew
  • 9,263
  • 1
  • 28
  • 43
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.

shakalandy
  • 768
  • 4
  • 10