laravel 错误:脚本 php artisan clear-compiled 处理 post-install-cmd 事件返回错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24298722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:51:18  来源:igfitidea点击:

ERROR: Script php artisan clear-compiled handling the post-install-cmd event returned with an error

laravellaravel-4

提问by frankzk

I am trying to create a laravel project with this:

我正在尝试使用以下内容创建一个 Laravel 项目:

Nicoles-MacBook-Pro:htdocs nicolekajatt$ composer create-project laravel/laravel guia-telefonica

And i am getting this:

我得到了这个:

Mcrypt PHP extension required.
Script php artisan clear-compiled handling the post-install-cmd event returned with an error



  [RuntimeException]  
  Error Output:       



create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [package] [directory] [version]

I have tried this tutorial to fix this but the problem stills http://laravel.io/forum/02-08-2014-difficulty-installing-laravel-getting-error-mcrypt-php-extension-required?page=1

我已经尝试过本教程来解决这个问题,但问题仍然存在 http://laravel.io/forum/02-08-2014-difficulty-installing-laravel-getting-error-mcrypt-php-extension-required?page=1

What can i do? Thanks for the help

我能做什么?谢谢您的帮助

回答by Max

Following steps were helpful for me on Ubuntu:

以下步骤对我在 Ubuntu 上有帮助:

  1. Install php5-mcrypt using:

    apt-get install php5-mcrypt

  2. Activate mcrypt extension:

    php5enmod mcrypt

  3. Make sure it is loaded:

    php -i | grep mcrypt

  1. 使用以下命令安装 php5-mcrypt:

    apt-get install php5-mcrypt

  2. 激活 mcrypt 扩展:

    php5enmod mcrypt

  3. 确保它已加载:

    php -i | grep mcrypt

you should see mcrypt support => enabledif it is activated.

你应该看看mcrypt support => enabled它是否被激活。

回答by Sunny R Gupta

If you are on a Macintosh, try tho following:

如果您使用的是 Macintosh,请尝试以下操作:

cd ~ ; mkdir mcrypt ; cd mcrypt

Get libmcrypt 2.5.8 from Sourceforge.

从 Sourceforge 获取 libmcrypt 2.5.8。

Get the php code in a tar.gz or .bz2 format- (find your version of PHP by running php -v)

以 tar.gz 或 .bz2 格式获取 php 代码- (通过运行找到您的 PHP 版本php -v

Move both of these files that you downloaded into your working directory – mcrypt in this instance and go back to Terminal

将您下载的这两个文件移动到您的工作目录中 – 在本例中为 mcrypt 并返回到终端

cd ~/mcrypt

Expand both files by double clicking on them in the Finder.

通过在 Finder 中双击它们来展开这两个文件。

Remove the compressed archives

删除压缩档案

Change directory into libmcrypt

将目录更改为 libmcrypt

cd libmcrypt-2.5.8

./configure

make

sudo make install

With the libmcrypt configured and libraries now installed, time for to make the mcrypt extension.

现在配置了 libmcrypt 并安装了库,是时候制作 mcrypt 扩展了。

If you see any Autoconf Errors

如果您看到任何 Autoconf 错误

cd ~/mcrypt
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar xvfz autoconf-latest.tar.gz
cd autoconf-2.69/
./configure
make
sudo make install

Compile mcrypt php Extension

编译 mcrypt php 扩展

cd ../php-5.4.17/ext/mcrypt/
/usr/bin/phpize
./configure
make
sudo make install

Open /etc/php.iniand add the line below at the end

打开/etc/php.ini并在最后添加下面的行

extension=mcrypt.so

If there is no php.inifile, then you need to make one from php.ini.default in the same location like so:

如果没有php.ini文件,那么您需要从 php.ini.default 在同一位置创建一个文件,如下所示:

sudo cp /etc/php.ini.default /etc/php.ini

And allow write capability

并允许写入能力

sudo chmod u+w  /etc/php.ini

Then add the line as above in your favourite text editor:

然后在您喜欢的文本编辑器中添加如上的行:

sudo nano /etc/php.ini

Finally Restart Apache

最后重启Apache

sudo apachectl restart

Now you should be able to install Laravel.

现在你应该可以安装 Laravel 了。

SOURCE: http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/

来源:http: //coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/

回答by Carey Estes

If you are using Macports, this works: via http://rowdydesign.com/blog/2014/04/using-php-composer-under-mac-os-x-with-macports

如果您使用的是 Macports,这有效:通过http://rowdydesign.com/blog/2014/04/using-php-composer-under-mac-os-x-with-macports

run in Terminal

在终端运行

sudo ln -s /opt/local/bin/php54 /opt/local/bin/php
sudo ln -s /opt/local/bin/php-config54 /opt/local/bin/php-config
sudo ln -s /opt/local/bin/phpize54 /opt/local/bin/phpize

and change php54 to whatever version of php you are using, ie php53, php55

并将 php54 更改为您使用的任何版本的 php,即 php53、php55

回答by Waleed Khan

On OS X, you can install the mcryptextension via Homebrew, i.e.

在 OS X 上,您可以mcrypt通过 Homebrew安装扩展,即

$ brew install php56-mcrypt

(You may want to brew search mcryptto find the version appropriate for your version of PHP.)

(您可能希望brew search mcrypt找到适合您的 PHP 版本的版本。)

After doing this, composerran successfully for me.

这样做后,composer为我成功运行。