How to Install MCrypt and cURL on Ubuntu Servers

This guide shows you how to install and configure two key extensions, Installing MCrypt and cURL, which aren't installed by default..

By Tim Trott | Linux Tips and Tutorials | July 16, 2013

For some unknown reason, the default installation of PHP on the Ubuntu Server does not install two popular (and often required) extensions - MCrypt and cURL. This guide shows you how to install and configure these two extensions.

Installing MCrypt

The MCrypt extension is used by phpMyAdmin, Magento and many other PHP applications for encrypting data (passwords, hashing and so on). Strangely the default installation of PHP5 on Ubuntu Server (at the time of writing) does not include this extension.

Installing MCrypt for PHP5 on your Ubuntu Linux system is as easy as entering the following command in the console:

sudo apt-get install php5-mcrypt

Then you will need to restart Apache to load the MCrypt extension. You can do this with the command:

sudo /etc/init.d/apache2 restart

Installing cURL

cURL is a PHP extension which allows you to connect to, and communicate with, different servers using an array of different protocols such as HTTP, HTTPS, FTP, telnet and file. By default, this is not included in a standard installation of PHP on Ubuntu Server. You can easily install cURL using the following command:

sudo apt-get install php5-curl

Again, you will need to restart Apache. You can install MCrypt and cURL then restart Apache once.

sudo /etc/init.d/apache2 restart

You can verify that these have been installed correctly by looking at the output from PHPInfo. You can do this from the command line console

$ php -r "phpinfo();"

Or, more easily from a PHP document. Create a new file in the document root called phpinfo.php and place the following line inside it.

php
<?php phpinfo(); ?>

Now access that file in your browser and you will see detailed information about the extensions loaded into PHP, including if installing MCrypt and cURL was successful.

Was this article helpful to you?
 

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

There are no comments yet. Why not get the discussion started?

We respect your privacy, and will not make your email public. Learn how your comment data is processed.