If you use mcrypt you need to install the following package on linux debian to enable mcrypt.
The easiest way is to install:
apt-get install php5-mcrypt
then restart apache2
service apache2 restart
then your Yii2 framework should not longer be complaining about missing mcrypt package.
If this does not work then sometimes you will need to run the following