Fisrt, find out where is the php.ini
:
php -i | grep php.ini
Then you will see something like these:
Configuration File (php.ini) Path => /usr/local/php/etc
Loaded Configuration File => /usr/local/etc/php54/php.ini
Open the Configuration File:
vim /usr/local/etc/php54/php.ini
search this file and check if you have something like this:
extension=mcrypt.so
copy mcrypt.so
to extension_dir
which is indicated also in php.ini.
or set mcrypt.modes_dir
mcrypt.modes_dir=/usr/lib/libmcrypt.so