PancakesNutella
PancakesNutella

Reputation: 163

How to align my PHP version on my Mac with the PHP version installed in MAMP during Laravel installation?

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!

Upvotes: 3

Views: 6644

Answers (2)

Ilkinium
Ilkinium

Reputation: 100

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

Upvotes: 5

Zakaria Wahabi
Zakaria Wahabi

Reputation: 213

Open terminal and type the following commands :

$ echo "export PATH=/Applications/MAMP/bin/php/php5.5.14/bin:$PATH" >> ~/.profile

and then type :

$ . ./.profile

Now , whe you type wish php , it tell you that the php used is Application/MAMP/..../php(your version)/bin/php

Upvotes: 0

Related Questions