6
votes

OK, I have seen many posts about this, and I have spent the entire day working through them to solve this issue, with no success.

I am trying to create a Laravel project. I am using a Mac (Yosemite), which is running PHP 5.5.14. There is also an older version of PHP on the machine. When I try to create a project from the command line using "laravel new projectname", no errors are reported, but the command just creates an empty folder named with the project name. I get the "Crafting application..." and "Application ready! Build something amazing" messages but, again, only an empty folder.

If I try to use this command: composer create-project laravel/laravel projectname

I get this:

Installing laravel/laravel (v5.0.16) - Installing laravel/laravel (v5.0.16) Downloading: 100%

Created project in projectname Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Your requirements could not be resolved to an installable set of packages.

Problem 1 - Installation request for laravel/framework v5.0.16 -> satisfiable by laravel/framework[v5.0.16]. - laravel/framework v5.0.16 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

In the terminal, if I enter this: which php I get: /usr/bin/php /usr/bin/php -v I get: PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

I used homebrew to install autoconf and mcrypt with this command: brew install autoconf mcrypt

If I run that command again, I get: Warning: autoconf-2.69 already installed Warning: mcrypt-2.6.8 already installed

Since I kept getting the error, I assumed it was installed in the wrong place so, I compiled and installed mcrypt myself using these instructions: [Install mcrypt php extension][1]. I used PHP version 5.5.14 during the install. Mcrypt was installed in this directory: /usr/lib/php/extensions/no-debug-non-zts-20121212/

I have restarted Apache. I have checked my .bash_profile to make sure /usr/bin is in my Path.

If I create a page with phpinfo() and view it in my browser, I see that mcrypt is listed in the "Module Authors" section of the page. It just lists the names of the people who created the module.

I am stumped. I look forward to any suggestions that people might offer (I really don't want to install a virtual box, or anything like that. Surely, I can get this module installed in the right place!)

Thanks very much!

4
Are you loading the extension in your ini config (something like extension=mcrypt.so)?AlpineCoder
Thank you for your response. I added "extension=mcrypt.so" to my php.ini file, and I restarted apache but, no luck. Still the same results when I try to create the laravel project using the composer command I listed above.rogdawg
run which mcrypt to determine it's location and then add that to your path export PATH=/usr/local/bin:$PATH.davidcondrey
I got it! When I added it to my php.ini file, I didn't do it correctly (I'm tired)! But, I fixed my mistake in the php.ini, and that has it working! Thank you so much! I don't remember seeing the addition to php.ini in any of the instructions I was working from...I will go back and check. I don't see how I could have missed that. Thanks again! What a relief to have this solved.rogdawg
possible duplicate of Yosemite php-gd + mcrypt installationKyslik

4 Answers

13
votes

I got this exact same problem too. You have to find php.ini for php cli and add extension=mcrypt.so

My system is running LAMPP server with preinstalled PHP. So, here's what I do:

Install mcrypt extension

I tried both:

sudo apt-get install mcrypt
sudo apt-get install php5-mcrypt

Configure php.ini for CLI

Then, edit php.ini located in /opt/lampp/etc/php5/cli/php.ini add extension=mcrypt.so on Dynamic Extension section (anywhere is fine I think). Don't forget to restart your server.

Try using composer to install laravel

Now, you can run whatever method you want to install laravel. I download Laravel 5 manually, unzip, then install using composer install command. I think your command composer create-project laravel/laravel projectname would've run smoothly too.

References: here

5
votes

mac users install brew and then enter

brew install php56-mcrypt

in terminal

EDIT

if you get any error using above line then try this command

brew install homebrew/php/php56-mcrypt
2
votes

Please following the step :

  1. cd /etc/php5/cli/conf.d
  2. ln -s ../../mods-available/mcrypt.ini 20-mcrypt.ini

Worked for me.

0
votes

For MAC users,

brew install homebrew/php/php56-mcrypt