How to fix–mcrypt PHP extension required in Laravel on Mac OS X (No MAMP)

Source: Internet
Author: User
Tags mcrypt

Laravel PHP Web framework requires certain libraries to function properly. One of these libraries is the MCrypt and the Php-mcrypt (bridge between MCrypt and PHP). However, there is a good chance so you'll run into issues while running Laravel if these libraries and the extensions is not properly installed.

When I got started with setting-Laravel on a Mac OS X maverics Development Machine, I-ran into this error which said:m Crypt PHP extension required. This can is fixed easily-in, ways either by installing Php54-mcrypt or the php55-mcrypt extension using Homewbrew for Mac or my manually compiling the php-mcrypt extension. The development machine have the pre-installed PHP on OS X Maverics and isn't the one from a third party package installer Li Ke MAMP.

Step 1:install mcrypt for Mac OS X maverics using homebrew-this command:

sudo brew install MCrypt

Just in case you get a brew error while running this command, this is the cowardly refusing to sudo error from brew, Fix it and try the above command again.

Step 2:install php-mcrypt Extension using brew (based on your PHP version PHP 5.4 or PHP 5.5:

sudo brew install Php55-mcrypt

Or

sudo brew install Php54-mcrypt

If You get errors like brew no available formula and then you'll have to build the mcrypt extension for PHP manually which is a really easy step.

After you do with above steps, you should now no longer see the Mcrypt PHP extension required error and is all Set to start your Laravel development.

Some Sample outputs:

Debjit-sahas-mac-mini:app debjit$ Brew Install MCrypt
==> Installing MCrypt Dependency:mhash
==> Downloading https://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.t
######################################################################## 100%
==>./configure--prefix=/usr/local/cellar/mhash/0.9.9.9
==> make Install
Error:the ' Brew link ' step did not complete successfully
The formula built, but was not symlinked into/usr/local
Could not symlink include/mhash.h
/usr/local/include is not writable.

You can try again using:
Brew Link Mhash
==> Summary

If you encounter errors like the ' Brew link ' step does not complete successfully or mcrypt.h not found and all you need to Do are issue the following commands in your terminal:

sudo brew link mcrypt

If above does not work then try the following command:

sudo brew link--overwrite mcrypt

Once Restart Apache After following these steps, you'll see the Laravel welcome Message:you has arrived

How to fix–mcrypt PHP extension required in Laravel on Mac OS X (No MAMP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.