Steps to enable PHP mcrypt extension in Windows and Linux server
To use cryptography in PHP mcrypt extension, it needs an algorithm which should be advanced more than our expectation. Yes, it is essential to protect the data and password too. For this type of encryption, the tool called “mcrypt” is used with the partner algorithms like TripleDES and AES etc. The interface of Mcrypt extension is widely recognized for encrypting cryptography library for Mcrypt.
Most probably, it is not possible to run a mcrypt without a third runner. So, PHP code is the one which helps to run mcrypt. This gives an awesome work in all types of PHP versions but for some versions such as 7.2, it is recommended only to use in PECL repository.
Let’s see steps to install PHP mcrypt extension in two types of servers such as:
Before a start-up, check the mcrypt extension is installed in Linux server or not. It’s just a confirmation!
Here’s a command to cross-check the installation of mcrypt extension:
After this command execution, check you get a message like “mcrypt extension installed already”. If you didn’t find installation then there is more number of tools to install it easier like apt-get and yum.
For example:
Below, you can see commands for few servers:
To get a successful installation of the mcrypt extension, it is must to apply the modifications by restarting the webserver.
For a server type of PHP 7.2+ use the below-mentioned command for execution:
PECL helps you to give a fine-touch of installation. Use the command to install mcrypt extension easier:
Finally, it is must process default prefix set up and make changes in the configuration of PHP. Make a move to restart the entire process!
It’s over here for mcrypt extension installation in Linux server!
Windows server:
Here, the Windows server has a mechanism to install mcrypt extension in two choices such as:
If you fail to enable mcrypt extension using the server control panel then uncomment the below command in php.ini:
Again all over here too! Give a webserver restart and don’t forget to save the changes before restarting the webserver.
To use cryptography in PHP mcrypt extension, it needs an algorithm which should be advanced more than our expectation. Yes, it is essential to protect the data and password too. For this type of encryption, the tool called “mcrypt” is used with the partner algorithms like TripleDES and AES etc. The interface of Mcrypt extension is widely recognized for encrypting cryptography library for Mcrypt.
Most probably, it is not possible to run a mcrypt without a third runner. So, PHP code is the one which helps to run mcrypt. This gives an awesome work in all types of PHP versions but for some versions such as 7.2, it is recommended only to use in PECL repository.
Let’s see steps to install PHP mcrypt extension in two types of servers such as:
- Linux server
- Windows server
Before a start-up, check the mcrypt extension is installed in Linux server or not. It’s just a confirmation!
Here’s a command to cross-check the installation of mcrypt extension:
Code:
Php –i | grep mcrypt
For example:
Below, you can see commands for few servers:
S.NO | SERVER NAME | COMMAND |
1. | CentOS | yum install php-mcrypt |
2. | Ubuntu/Debian | apt-get install phpxx-mcrypt |
To get a successful installation of the mcrypt extension, it is must to apply the modifications by restarting the webserver.
For a server type of PHP 7.2+ use the below-mentioned command for execution:
Code:
apt-get -y install gcc make autoconf libc-dev pkg-config
apt-get -y install php7.2-dev
apt-get -y install libmcrypt-dev
Code:
pecl install --nodeps mcrypt-snapshot
Code:
sudo bash -c "echo extension=mcrypt.so > /etc/phpxx/conf.d/mcrypt.ini"
sudo service php-fpm restart
Windows server:
Here, the Windows server has a mechanism to install mcrypt extension in two choices such as:
- Using the server control panel to enable mcrypt
- Making few changes in the file php.ini
If you fail to enable mcrypt extension using the server control panel then uncomment the below command in php.ini:
Code:
extension=php_mcrypt.dll