You are here
Home > Laravel > Solving The Mcrypt Extension Error For Laravel

Solving The Mcrypt Extension Error For Laravel

Now that you have decided to start use/learn Laravel and its good

When you try to work with new software and when it doesn’t work out of the box as expected; we know the frustration level as many of us might have gone through it. We have spend a good amount of hours figuring out what might be the problem in running this new piece of software and finally thought about writing it up for future use or if it could help anyone out there facing a similar sort of issue.

First Step: Before even trying to install Laravel

Before installing the Laravel, we need to ensure that our server meets the below requirements:

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Installing Laravel

Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.

Via Laravel Installer

First, download the Laravel installer using Composer:

Make sure to place the $HOME/.composer/vendor/bin directory (or the equivalent directory for your OS) in your $PATH so the laravel executable can be located by your system.

Once installed, the laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog will create a directory named blog containing a fresh Laravel installation with all of Laravel’s dependencies already installed:

Via Composer Create-Project

Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal:

And everything seems fine until I get this error:

Since we were using MacBook Pro having MAMAP running on it to test the Laravel.

Solution:You need to check the version of PHP running with MAMP Server and enable mcrypt support in your php.ini file to look like this:

Also after doing this you would require to edit .bash_profile script and create an export to our MAMP php version. Now that we have our PHP version, in our case 5.5.10, we can open our .bash_profile script:

and add our MAMP PHP version after the code already present

Now save the file and exit. Now, if you run again the Composer command inside your folder, the installation should successfully complete. and you would be able to see your new Laravel application start page.

Top