14

I have a Ubuntu 9.10 server. I have installed apache2 and php5 using the apt-get commands.

How does one install php extensions? Are there commands like apt-get to get them? Or should I manually look for the files on the php website and set them up in the php.ini?

More specifically, I need mcrypt, curl and gd.

Thanks

2 Answers 2

23

All you need to do is:

sudo apt-get install php5-mcrypt php5-curl php5-gd

If you need to check what is installed php-wise you can:

dpkg --list | grep php

EDIT: Removed sudo in the command above as it's not needed with dpkg --list.

6
  • no need for sudo when doing: dpkg --list ;)
    – rkthkr
    Apr 15, 2010 at 5:57
  • 1
    + restart apache
    – ripper234
    Oct 28, 2012 at 13:20
  • 2
    Some extensions will leave an ini file in /etc/php5/conf.d that needs to be merged into the main ini. To do this you normally use php5enmod and php5dismod to enable and disable the extension's config. For example, if I need to enable the MongoDB extension I would use php5enmod mongo. Using these commands means you never have to mess with sym links or have to manually edit your main ini.
    – Eno
    May 8, 2013 at 15:28
  • this works for ubuntu 13.04, with a clean install. if you are trying to get mongo working, you should install the mongo dependencies first.
    – dmanexe
    May 16, 2013 at 22:26
  • @Eno do you do a normal install eg sudo apt-get php5-gd then do sudo php5enmod php5-gd for example??? IF not, could you elaborate on the correct procedure? Thanks. Apr 11, 2015 at 18:00
3

Additionally, you can review the available PHP extensions on your Debian/Ubuntu system by:

apt-cache search php|egrep ^php5-

You must log in to answer this question.

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