dqqn32019 2015-05-29 10:07
浏览 177
已采纳

如何在我的Mac上将我的PHP版本与Laravel安装期间安装在MAMP中的PHP版本对齐?

I am installing Laravel on Yosemite, with PHP installed under MAMP. I have already installed Composer in Terminal successfully.

The problem is that I have an older PHP version on my system (PHP 5.5.20 (cli)), while the PHP version in MAMP is 5.6.7. As a result, I have the following error message

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.

So I followed this very useful link to install Laravel with Mamp, which includes a great post in the comments section from Phil T. [link]http://shabeebk.com/blog/how-to-install-laravel-in-mamp/#comments

Given that mcrypt already exists in MAMP but not on my system, could you please detail the PATH command I should write to solve this? Thanks for your help guys!

  • 写回答

2条回答 默认 最新

  • douerqu2319 2015-05-29 10:46
    关注

    I think maybe you're using default php builded on yosemite.

    1. Type php --ini in terminal. you'll see information about php.ini file. for exp. Configuration File (php.ini) Path: /Applications/XAMPP/xamppfiles/etc Loaded Configuration File: /Applications/XAMPP/xamppfiles/etc/php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none)

      1. Or type which php and you'll see path of php folder for exp.

      /Applications/XAMPP/xamppfiles/bin/php

    If it's different than MAMP folder (if it's default - /usr/bin/php) Change it to MAMP folder. To do it you need to change .bash_profile and add the MAMP version of PHP to the PATH variable. You can edit .bash_profile with vim. Export the path variable with command

    export PATH=/Applications/MAMP/bin/php/php[php.version]/bin:$PATH
    

    Finally, check again if php path is correct with commands php --ini or which php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?