Call to undefined function mcrypt_module_open
- By Preneesh AV --
- 23-Mar-2019 --
- 125 Comments
Install mcrypt based on your php version
sudo apt-get updatesudo apt-get install mcrypt php7.1-mcrypt
or
sudo apt-get-y install gcc make autoconf libc-dev pkg-configsudo apt-get-y install php7.2-devsudo apt-get-y install libmcrypt-devsudo pecl install mcrypt-1.0.1
locate your php.ini file for editing :
php --ini
You should add "extension=mcrypt.so" to php.ini, the location for version php 7.2
sudo vi /etc/php/7.2/cli/php.ini
create a php file and add the following code:
<?php phpinfo();?>
and open it in browser, it will show the php file which is actually being read by apache2. In our case it was
Loaded Configuration File: /etc/php/7.2/apache2/php.ini
You should add "extension=mcrypt.so" to php.ini, the location for version php 7.2
sudo vi /etc/php/7.2/apache2/php.ini
finally we need to restart the apache2 server
service apache2 restart