Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
up vote 16 down vote accepted

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.

share|improve this answer
no need for sudo when doing: dpkg --list ;) – rkthkr Apr 15 '10 at 5:57
+ restart apache – ripper234 Oct 28 '12 at 13:20
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 '13 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 '13 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. – Phill Healey Apr 11 '15 at 18:00

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

apt-cache search php|egrep ^php5-
share|improve this answer

Your Answer


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.