Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

Mcrypt PHP extension required

I am trying to run below project in my localhost.

https://i.stack.imgur.com/HzKLb.png

My PHP configuration is like below

https://i.stack.imgur.com/iRwDT.png

I am trying to run php artisan --version command. I am getting below error

https://i.stack.imgur.com/TaYkL.png

0 likes
19 replies
Sinnbeck's avatar

Assuming ubuntu :)

sudo apt install php7.1-mcrypt
2 likes
sauravs012's avatar

Had the same issue - PHP7 missing mcrypt.

This worked for me in Ubuntu Please try below commands.

sudo apt-get update
sudo apt-get install mcrypt php7.1-mcrypt
sudo apt-get upgrade

Then restarts apache

sudo service apache2 restart

Hope this commands helps!

1 like
Sinnbeck's avatar

Yes I wont work for 7.1. The guide you are following is for php 7.2 and up.

My solution should work for php 7.1. If you gave more info than "No working" I might be able to help

1 like
Sinnbeck's avatar

Try running these one and the time, and tell me what error you are getting (if any). If no errors occured, then reboot and see if it works :)

sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.1-mcrypt
2 likes
Sinnbeck's avatar

Can you try running php -v and post the output?

1 like
Sinnbeck's avatar

Ok as already mentioned in that tread you have multiple versions of php. You website is using 7.1 and artisan is using 7.4. They should be the same.

Which version do you wish to use?

1 like
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Try this then

sudo update-alternatives --set php /usr/bin/php7.1

After that it should work

1 like

Please or to participate in this conversation.