Silverstripe on macOS Mojave with MAMP Pro 5


#1

For your Mac terminal to be able to deal with SilverStripe 4.2.2 it needs to have PHP with the intl extension installed amongst others but that’s the problem one.

If you’re running MAMP Pro 5 here is what to do.

Install Visual Studio Code on macOS Mojave:

Edit Bash Profile with this terminal command:
code .bash_profile

And add to Bash Profile:
export PATH=/Applications/MAMP/bin/php/php7.1.22/bin:$PATH

There are other ways to do the above but that’s one of the easier ways.

Every MAMP Pro 5 update will change the default PHP versions and path so just go into the Bash Profile and update the path. It’ll work again then.

Also…

One of the most essential things about setting up a SilverStripe 4 site is to know what PHP version you will have on your hosting platform. Find out early.

Find that out and set your local dev project to copy it.

composer config platform.php 7.0.30

This will add to your composer.json (so you can tweak it later):

"config": {
        "process-timeout": 600,
        "platform": {
              "php": "7.0.30"
         }
 },

That will force composer to install symfony and other PHP modules with the right PHP requirements. Even if you run your dev server on PHP 7.1 it’ll still pull the right vendor files for your hosting server then.

That is important if your host doesn’t support composer.

I’m happily running a PHP 7 for the front end and hosting and PHP 7.1 for the command line no problem.

I put this here because the SilverStripe documentation is out of date and SilverStripe devs are recommending not using MAMP Pro 5 on macOS anymore. But it works perfectly so I think it’s important to get the setup sorted.

Please comment below if you have any further MAMP Pro 5 tips.

I’m also still maintaining many SilverStripe 3 websites on PHP 5.6 and PHP 7 along with upgrading projects to SilverStripe 4 and many custom PHP apps.