1
votes

I am trying to migrate laravel app into ubuntu and getting error like Mcrypt PHP extension required. when i check php details with phpinfo() function it showing below screen.

screen shot of mcrypt extension

PLlease find the Terminal Screenshot below,

terminal screenshot

php.ini

enter image description here How to solve this issue ?

2
Install mcrypt and Uncomment or add the mcrypt extension in php.ini fileSougata Bose
Your php sapi may not be the same when serving scripts for your http server from when invoking in command line, so the php.ini file maybe a different one. Try php --ini in your bash to see which is the php.ini file for cli.demental
@demental, how can i solve this.Jishad
@demental, Configuration File (php.ini) Path: /etc/php5/cli Loaded Configuration File: /etc/php5/cli/php.ini Scan for additional .ini files in: /etc/php5/cli/conf.d Additional .ini files parsed: /etc/php5/cli/conf.d/05-opcache.ini, /etc/php5/cli/conf.d/10-pdo.ini, /etc/php5/cli/conf.d/20-json.ini, /etc/php5/cli/conf.d/20-readline.iniJishad

2 Answers

0
votes

If you have installed PHP through apt-get then find the mcrypt extension you are using either for apache by using

$ locate *mcrypt.ini
/etc/php5/apache2/conf.d/20-mcrypt.ini
/etc/php5/cli/conf.d/20-mcrypt.ini
/etc/php5/fpm/conf.d/20-mcrypt.ini
/etc/php5/mods-available/mcrypt.ini
/usr/share/php5/mcrypt/mcrypt.ini
/var/lib/ucf/cache/:etc:php5:mods-available:mcrypt.ini

go into the directory that you have your extension in

cd /etc/php5/apache2/conf.d/20-mcrypt.ini

and you will probably find there is a symlink to the mcrypt extension in the mods-available directory. If that's the case all you have to do is cd into the /etc/php5/cli/conf.d directory and create a similar symlink

cd /etc/php5/cli/conf.d
sudo ln -s ../../mods-available/mcrypt.ini ./

then restart php maybe with sudo service php5 restart

That should work

0
votes

Find mcrypt.ini file in /etc/php5/mods-available/mcrypt.ini ,if this file does not exist,means php5-mcrypt could create the file.

  • create the file mcrypt.ini in dir /etc/php5/mods-available/
  • And add the following config to it:

    extension=mcrypt.so

  • Run this commands

    sudo php5enmod mcrypt sudo service php5-fpm restart

This worked for me.Cheers