Cannot create Laravel project because mcrypt extension is missing

Well, I saw a lot of posts about this, and I spent all day working on them to solve this problem, without any success.

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

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

I get this:

Install laravel / laravel (v5.0.16) - Install laravel / laravel (v5.0.16) Download: 100%

A project has been created in the name of the project. Downloading composer repositories with package information. Installing dependencies (including require-dev) from the lock file. Your requirements cannot be resolved to the set of packages being installed.

Problem 1 - Installation request for laravel / framework v5.0.16 → we will execute according to laravel / framework [v5.0.16]. - laravel / framework v5.0.16 requires ext-mcrypt * → the requested mcrypt PHP extension is missing on your system.

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

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

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

Since I continued to receive the error, I assumed that it was installed in the wrong place, so I compiled and installed mcrypt myself using the following instructions: [Install the mcrypt php extension] [1]. During the installation, I used PHP version 5.5.14. Mcrypt was installed in this directory: / usr / lib / php / extensions / no-debug-non-zts-20121212 /

I restarted Apache. I 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 simply lists the names of the people who created the module.

I'm at a dead end. I look forward to any suggestions that people can offer (I really do not want to install a virtual box or something like that. Of course, I can install this module in the right place!)

Thank you very much!

+6
source share
5 answers

I have the same problem too. You should find php.ini for php cli and add extension=mcrypt.so

My system has a LAMPP server with PHP preinstalled. So here is 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 in the Dynamic Extension section (anywhere, I think). Do not forget to restart the server.

Try using composer to install laravel

Now you can run any method you want to install laravel. I download Laravel 5 manually, unzip it, and then install it using the composer install command. I think your composer create-project laravel/laravel projectname will work fine.

Literature: here

+12
source

mac users install brew and then type

 brew install php56-mcrypt 

in the terminal

EDIT

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

 brew install homebrew/php/php56-mcrypt 
+5
source

Please follow the step:

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

Worked for me.

+2
source

For MAC Users

brew install homebrew / php / php56-mcrypt

0
source

I also could not get it to work this way after numerous trials. So, I tried an alternative way.

global composer requires "laravel / installer = ~ 1.1"

laravel new projectname

It was a success.

-2
source

Source: https://habr.com/ru/post/983809/


All Articles