1

I'm new to Composer and am using a Mac along with MAMP as a local web server. I've installed Composer but it's referencing an old PHP 5 version that must be the default on my Mac.

I was able to install Craft 3 via Composer by adding the --ignore-platform-reqs flag as per https://docs.craftcms.com/v3/installation.html#downloading-with-composer

The Craft 3 starter project files were all added successfully. However, at the end of the install output in terminal was the following:

@php craft setup/welcome
Craft requires PHP 7.0 or later.

If I navigate to the project install directory and try running ./craft setup I get the same message "Craft requires PHP 7.0 or later".

The installation docs did say you could alternatively edit the .env file directly, so I entered the database details in there instead. But when I went to access the browser install wizard, I got errors about the security key being missing.

Now I worked around that by just generating a random 32 character string myself and entering this for the SECURITY_KEY setting in the .env file & was then able to complete the install wizard.

However, I'm wondering if that is OK to do? I'm concerned that there may be a particular format needed etc and that just pasting in my own key could cause issues down the line.

Ideally I'd prefer to be able to just complete the standard setup via terminal instead and have the key config automatically set there. Is there a way I can get the craft setup command to use the newer PHP 7+ available from MAMP? Or is there an easy way to update the default PHP version Composer references without disturbing the rest of my Mac?

2 Answers 2

2

Add this line to your ~/.bash_profile file

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.0.0/bin:${PATH}"

Assuming your php7 version in mamp is 7.0.0 of course.

Here is a link with a few more steps if you aren't sure how to edit that file - https://gist.github.com/irazasyed/5987693

1
  • Many thanks for your help John - it's great to have this sorted!
    – Janine
    Commented Jan 9, 2018 at 17:37
2

Recent versions of macOS High Sierra come with PHP 7.1.7, so another option is you can try upgrading your OS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.