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

thestapler's avatar

Laravel5 - new install - MCRYPT_RIJNDAEL_128 notice

When I run php artisan, I get this error:

PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /var/www/lv5/config/app.php on line 83
PHP Stack trace:
PHP   1. {main}() /var/www/lv5/artisan:0
PHP   2. Illuminate\Foundation\Console\Kernel->handle() /var/www/lv5/artisan:36
PHP   3. Illuminate\Foundation\Console\Kernel->bootstrap() /var/www/lv5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:89
PHP   4. Illuminate\Foundation\Application->bootstrapWith() /var/www/lv5/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:192
PHP   5. Illuminate\Foundation\Bootstrap\LoadConfiguration->bootstrap() /var/www/lv5/storage/framework/compiled.php:1307
PHP   6. Illuminate\Foundation\Bootstrap\LoadConfiguration->loadConfigurationFiles() /var/www/lv5/storage/framework/compiled.php:1788
PHP   7. require() /var/www/lv5/storage/framework/compiled.php:1796

it is a fresh install of XUBUNTU, PHP5 (with mcrypt), APACHE2, MySQL. I didnt' have this issue when I installed it at work, but when I was starting to play with it at home, I got this issue... :(

Any idea??

0 likes
7 replies
thestapler's avatar

Thanks, I guess my google-fu is not working today.... amazing what

sudo php5enmod mcrypt

will do

3 likes
sabotager22's avatar

That was helpful for me:

sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart

Source - http://www.kvcodes.com/2014/07/laravel-requires-mcrypt-php-extension/

P.S. I am on:

Debian GNU/Linux 7.8 (wheezy)
PowerMac8,2
ppc64

Has been edited due to the new problem: When I did laravel artisan serve I got this

PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0

that warning came up, because too many mcrypt.ini files has been created ...

  1. /etc/php5/mods-available/mcrypt.ini
  2. /etc/php5/cli/conf.d/mcrypt.ini
  3. /etc/php5/cli/conf.d/20-mcrypt.ini
  4. /etc/php5/conf.d/20-mcrypt.ini

... to solve it, I've just deleted all of them and put next line into [mcrypt] section in php.ini file (/etc/php5/cli/php.ini)

[mcrypt]
. . . . . . . . . . .
. . . . . . . . . . .
extension=mcrypt.so

Don't forget to do sudo service apache2 restart

That helped in my case

1 like
psybaron's avatar

If you are having this issue with Homestead (v4) and PHP7 do this:

sudo apt-get install php7.0-mcrypt

sudo service nginx restart

Should be good to go.

2 likes
brendanfalkowski's avatar

I was super stumped by this for a month. Nothing worked.

Decided to pop over to the Laravel repo: https://github.com/laravel/laravel/

And take a look at the latest version of: /config/app.php

Yeah, so it doesn't use the "MCRYPT_RIJNDAEL_128" cipher anymore. I guess that was the default in like Laravel 4.

Now it uses "AES-256-CBC" (note: your key must be 32 chars).

So I changed that in my local file, and voila! — Homestead v4 with PHP 7 works.

2 likes

Please or to participate in this conversation.