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

gj1118's avatar

laravel mcrypt

Hi , I am having a weird issue.

I have installed laravel on my new box. The installation went fine. Laravel didn't error out with the Mcrypt issue. However whenever I am on the site, I get this white page with the error : Mcrypt PHP extension required.

I am using nginx and I have already followed this http://stackoverflow.com/questions/25117912/mcrypt-php-extension-required

I did run php -m - mcrypt is listed there.

I have also cleared my browser cache.

Can you please help me get out of this issue?

thanks

0 likes
28 replies
Devon's avatar

Are you using artisan serve or another web server?

gj1118's avatar

nginx - sorry about that . I should have said that in my question itself. did that - just now. thanks

gj1118's avatar

@nesl247 I did do this php -m | grep mcrypt and it returned mcrypt .. so that would mean that its enabled , right ? do i still need to go further with the link ?

nesl247's avatar

@gj1118 php -m is only showing you modules that were compiled in, not ones that are loaded. So yes, you would still need to follow that link.

gj1118's avatar

array(47) { [0]=> string(4) "Core" [1]=> string(4) "date" [2]=> string(4) "ereg" [3]=> string(6) "libxml" [4]=> string(7) "openssl" [5]=> string(4) "pcre" [6]=> string(4) "zlib" [7]=> string(6) "bcmath" [8]=> string(3) "bz2" [9]=> string(8) "calendar" [10]=> string(5) "ctype" [11]=> string(3) "dba" [12]=> string(3) "dom" [13]=> string(4) "hash" [14]=> string(8) "fileinfo" [15]=> string(6) "filter" [16]=> string(3) "ftp" [17]=> string(7) "gettext" [18]=> string(3) "SPL" [19]=> string(5) "iconv" [20]=> string(8) "mbstring" [21]=> string(5) "pcntl" [22]=> string(7) "session" [23]=> string(5) "posix" [24]=> string(10) "Reflection" [25]=> string(8) "standard" [26]=> string(5) "shmop" [27]=> string(9) "SimpleXML" [28]=> string(4) "soap" [29]=> string(7) "sockets" [30]=> string(4) "Phar" [31]=> string(4) "exif" [32]=> string(7) "sysvmsg" [33]=> string(7) "sysvsem" [34]=> string(7) "sysvshm" [35]=> string(9) "tokenizer" [36]=> string(4) "wddx" [37]=> string(3) "xml" [38]=> string(9) "xmlreader" [39]=> string(9) "xmlwriter" [40]=> string(3) "zip" [41]=> string(3) "PDO" [42]=> string(4) "curl" [43]=> string(4) "json" [44]=> string(8) "readline" [45]=> string(5) "mhash" [46]=> string(12) "Zend OPcache" }

FrancescoZaffaroni's avatar

Search in your php.ini for a line containing

extension=php_mcrypt.so

if it's commented (starts with a semicolon ;) uncomment it and restart nginx.

gj1118's avatar

It did not exist. I have added that and restarted the nginx server. but to no avail.

gj1118's avatar

restarting php-fm did make that error go away. but now i am getting a very vague Error in exception handler. nothing else is being shown.http://104.131.37.52/ . the logs folder is still empty..

FrancescoZaffaroni's avatar

try to change the line to

extension=mcrypt.so

and restart again, sorry if but with the information you gave we have to go by trial and error.

gj1118's avatar

that is ok . your help is indeed praiseworthy.. i did that , and i am getting the same issue. i restarted both php-fm and the nginx services

gj1118's avatar

I am going to destroy that droplet and going to create another one , just to start afresh ..

FrancescoZaffaroni's avatar

before try this

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

And then restart everything

henrique's avatar

Try chmoding the storage folder

sudo chmod -R 777 app/storage
FrancescoZaffaroni's avatar

I don't think it's that, since when he ran this get_loaded_extensions() mcrypt didn't show up in the array.

Valorin's avatar

Try running this command, it will tell PHP5 to enable mcrypt.

sudo php5enmod mcrypt
gj1118's avatar

@Francesco Zaffaroni did that as well.. it did not work . same thing. @others I have tried doing what you have suggested but the box will not simply work. Out of sheer frustration i pressed the bug huge red button and destroyed the box. Going ahead to press the small green button to create the droplet and try it again. Will keep you guys posted

henrique's avatar

@Francesco Zaffaroni yeah, but that was before he said that restarting php-fpm made the error go away and get a blank screen with no logs :)

From my experience at digital ocean with laravel, those are the first two errors I get, first mcrypt (solved by installing and restarting) and then a blank screen with no log (solved by giving permission to the storage folder)

gj1118's avatar
gj1118
OP
Best Answer
Level 2

Guys, I managed to resolve the issue. The issue was (what no sane mind would do ) I was not setting the correct php.ini . The correct php.ini is in the php-fpm folder while I was modifying the one in the cli folder. Phew .. it was a long day ! Nuclear launch aborted !

2 likes
amaille's avatar

JFYI, you could check extension by the command php --ri : php --ri mcrypt

Devon's avatar

Been there, done that @gj1118... Glad you figured it out.

You should mark your last response as the answer. :)

Please or to participate in this conversation.