Most of web-based application development todays were developed using database. The most popular one is using PHP and MySQL. When developing using MySQL most of beginners were using phpMyAdmin as their power tools in database CRUD (Create-Read-Update-Delete) as well as databases/tables creation and manipulation.
PhpMyAdmin supports encryption feature which enables database developers to raise their application security bar in database. In order to use encryption feature in PHP, phpMyAdmin need a PHP library called mcrypt to be enabled. If it is not already installed during php installation, then you have to enabled it on php.ini either manually or automagically (by script).
Mcrypt is an interface to the mcrypt library, which supports a wide variety of block algorithms such as DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it supports RC6 and IDEA which are considered “non-free”. CFB/OFB are 8bit by default.
First what you need to do is checking whether mcrypt is already enabled on your php configuration or not. Create a phpinfo.php which contains only the following one line:
<?php phpinfo(); ?>
Save it on your web server document root. If your web server location is on the same computer as your web browser, access those file from web browser using the following URL:
localhost is the alias name of loopback ip address 127.0.0.1. Sometimes your computer couldn’t recognize localhost as 127.0.0.1 (as on my Mac computer), if so you have to use the latter URL.
If you see something like the above picture, then you’re set to go, PHP Mcrypt library is ready to be used on your application project.
If not, then you have to install it using the Ubuntu apt-get command:
apt-get install php5-mcrypt
and then Ubuntu’s aptitude will do the download and configuring the rest for you (automagically). Make sure your computer has internet access to download the required files and dependency.
After successfully installed, restart your (Apache) web server using the following command:
service apache2 restart
Then refresh your browser using the same URL, you should see the mcrypt library loaded and you’re good to go. Hope this helps.
Before executing any apt-get command, you have to execute those command as super user (root). Or append the apt-get command with sudo.
Sometimes you might get the message “php5-mcrypt is already the newest version“. If so, install with:
apt-get --reinstall install php5-mcrypt
In case someone still had an error of Mcrypt is not being installed, even after installing php5-mcrypt module using apt-get, find where your php.ini is located and put or enable (by removing the semicolon) the following line:
and restart Apache.
In some systems, you have to find where php5 configuration folder is located (in my case it is on
/etc/php5/conf.d/ directory) and put an
mcrypt.ini file which contains
save the file and restart Apache.
Hope this helps.