24

When trying to install webtrees I get the following output:

Checking server configuration

PHP extension "pdo_mysql" is disabled. You cannot install webtrees until this is enabled. Please ask your server's administrator to enable it.

PHP extension "gd" is disabled. Without it, the following features will not work: creating thumbnails of images. Please ask your server's administrator to enable it.

How do I install and enable the pdo_mysql and gd extensions?

3 Answers 3

38

PHP5 plugins outside those included in a plain default install (from installing just a php5 plugin for apache, or php5-fpm or similar) will not exist, and because of that, you need to install them. From your post, I gather that you need the mysql and gd plugins. Those packages are php5-gd and php5-mysql. They can be installed with the following command:

sudo apt-get install php5-gd php5-mysql

Once complete, you will need to restart the PHP service. Depending on how it was installed, you will need to do one of the following items:

  • If you installed it via LAMP (Linux Apache, MySQL, PHP5), then you'll need to restart the entire apache instance with: sudo service apache2 restart
  • If you installed PHP from a separate service, like php5-fpm, then use sudo service php5[tab] restart (where you actually press the "tab" key where it says [tab]) After that, your php5 should have those extensions loaded.
9
  • I am still getting the same error messages. Plus php5: unrecognized service, after the restart.
    – user221117
    Dec 1, 2013 at 19:53
  • How did you install PHP in the first place? What package(s) did you install to get PHP on your system
    – Thomas Ward
    Dec 1, 2013 at 20:16
  • @user221117 I have provided edits, I'm guessing you're using LAMP so I added additional instructions to reload PHP because you have to stop/start the apache2 service because PHP is a plugin and not a standalone service. (I commented to the server team that this is bloody inefficient but meh)
    – Thomas Ward
    Dec 1, 2013 at 20:33
  • Thank you for your help. I thought I got a way from shutting things down and restarting when I left Windoze years ago. But, it works. so, thanx again.
    – user221117
    Dec 2, 2013 at 0:59
  • @user221117 Many programs are like this, after you modify what loads (plugins, configuration, etc.) you have to reload the configuration. With Apache, in order to refresh PHP5's plugins, you have to restart the Apache instance completely. Also, if my answer has helped solve the issue, please mark this answer as accepted when the system permits it.
    – Thomas Ward
    Dec 2, 2013 at 1:33
3

If the above answer doesn't works for you:

Just remove the version number: sudo apt-get install php-mysql

Or if you need a specific package, add the minor version: sudo apt-get install php7.0-mysql


Or check php installation:

check php version via: php -v

if an error shows up check the correct php installation.

0

For PHP 7.2, here is the command: enter image description here

For any generic php version first try sudo apt-get install php-gd

1
  • 2
    Instead of embedding an image, it's better to paste the relevant text into the answer, formatted as code. Oct 21, 2019 at 5:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .