简体   繁体   English

使用Composer安装Laravel 4时出错

[英]Error installing Laravel 4 with composer

When I try to install Laravel 4 via Composer, I get the following message in Terminal 当我尝试通过Composer安装Laravel 4时,在终端中收到以下消息

Mcrypt PHP extension required. 需要Mcrypt PHP扩展。 Script php artisan optimize handling the post-install-cmd event returned with an error 脚本php artisan优化处理错误返回的post-install-cmd事件

The PHP version on my computer is 5.5.3 and when I run phpinfo it shows that mcrypt is enabled. 我计算机上的PHP版本是5.5.3,当我运行phpinfo时,它表明已启用mcrypt。 When I run the which php command in Terminal it shows 当我在终端中运行哪个php命令时,它显示

/usr/bin/php 在/ usr / bin中/ PHP

I therefore extended the $PATH with .bash_profile. 因此,我使用.bash_profile扩展了$ PATH。

export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH

Unfortunately, the which php command still shows /usr/bin/php after extending $PATH. 不幸的是,扩展$ PATH后,哪个php命令仍然显示/ usr / bin / php。 And as a result the error is still there. 结果,错误仍然存​​在。 So I am out of ideas on how to solve this issue. 因此,我对如何解决此问题没有任何想法。 Does anyone have an idea? 有人有主意吗? Thanks! 谢谢!

  1. There is difference between the MAMP PHP version and you "Terminal" PHP version. MAMP PHP版本与您的“ Terminal” PHP版本有所不同。 Therefore are you probably setting up the export path. 因此,您可能要设置导出路径。
  2. When you are changing the export path you have to restart your terminal before it will take effect on your computer. 更改导出路径时,必须重新启动终端,然后终端才能在计算机上生效。
  3. I am not sure of this but when your error is appearing and older version of Laravel will be installed. 我不确定这一点,但是当您的错误出现时,将安装较旧的Laravel版本。

What do you get when you execute: php -v in your terminal? 在终端执行php -v会得到什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM