无法创建Laravel项目,因为缺少mcrypt扩展 [英] can't create a Laravel project because mcrypt extension is missing

查看:316
本文介绍了无法创建Laravel项目,因为缺少mcrypt扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我看到了很多与此相关的帖子,并且整整一整天都在努力解决这些问题,但没有成功.

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.

我正在尝试创建一个Laravel项目.我正在使用运行PHP 5.5.14的Mac(优胜美地).该计算机上还有一个较旧的PHP版本.当我尝试使用"laravel new projectname "从命令行创建项目时,没有错误报告,但是该命令只是创建一个以项目名称命名的空文件夹.我收到正在制作应用程序..."和应用程序准备就绪!构建出色的消息"的消息,但同样只有一个空文件夹.

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.

如果我尝试使用此命令: 作曲家create-project laravel/laravel 项目名称

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

我明白了:

安装laravel/laravel(v5.0.16) -安装laravel/laravel(v5.0.16) 下载:100%

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

projectname 中创建的项目 使用软件包信息加载作曲家存储库 从锁定文件安装依赖项(包括require-dev) 您的要求无法解决为一组可安装的软件包.

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.

问题1 -laravel/framework v5.0.16的安装请求-> laravel/framework可满足[v5.0.16]. -laravel/framework v5.0.16要求ext-mcrypt *->系统中缺少所请求的PHP扩展名mcrypt.

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.

在终端中,如果我输入以下内容: 哪个PHP 我得到:/usr/bin/php /usr/bin/php -v 我得到: PHP 5.5.14(CLI)(建立:2014年9月9日19:09:25) 版权所有(c)1997-2014 The PHP Group Zend Engine v2.5.0,版权所有(c)1998-2014 Zend Technologies 与Xdebug v2.2.3,版权(c)2002-2013,作者Derick Rethans

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

我使用自制程序通过以下命令安装autoconf和mcrypt: brew install autoconf mcrypt

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

如果再次运行该命令,则会得到: 警告:autoconf-2.69已安装 警告:已经安装了mcrypt-2.6.8

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

由于我一直收到错误,所以我假设它安装在错误的位置,所以我按照以下说明自己编译并安装了mcrypt: [安装mcrypt php扩展名] [1].我在安装过程中使用的是PHP 5.5.14版本. Mcrypt已安装在以下目录中:/usr/lib/php/extensions/no-debug-non-zts-20121212/

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/

我已经重新启动了Apache.我已经检查过.bash_profile,以确保/usr/bin位于我的路径中.

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

如果我使用phpinfo()创建一个页面并在浏览器中查看它,则会看到该页面的模块作者"部分列出了mcrypt.它仅列出创建模块的人员的姓名.

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!)

非常感谢!

推荐答案

我也遇到了同样的问题. 您必须找到php cli的php.ini并添加extension=mcrypt.so

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

我的系统正在使用预安装的PHP运行LAMPP服务器.所以,这就是我的工作:

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

安装mcrypt扩展名

我都尝试过

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

为CLI配置php.ini

然后,编辑位于/opt/lampp/etc/php5/cli/php.ini Dynamic Extension 部分中的extension=mcrypt.so中的php.ini(我认为任何地方都可以).不要忘记重启服务器.

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.

尝试使用Composer安装laravel

现在,您可以运行想要安装laravel的任何方法.我手动下载Laravel 5,解压缩,然后使用composer install命令安装.我认为您的命令composer create-project laravel/laravel projectname也会顺利运行.

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.

参考: 此处

这篇关于无法创建Laravel项目,因为缺少mcrypt扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆