OK, I was fed up off all other solutions which weren't working, so finally downloading and compiling php from source itself worked.
So here's what I did:
- Download php from official site
Follow following instructions
cd to/extracted/php/folder cd /ext/mycript phpize ./configure make make test sudo make install
Add extension=mcrypt.so
to /etc/php.ini
file.
Now restart the server
sudo apachectl restart
You are good to go, Cheers! :)