Installing a specific PHP version with macports - php

I need to mimic my hosting environment, so composer and symfony would respect the environment.
My host is on PHP 7.0.6
And my local environment is on 7.0.21
During an upgrade doctrine/doctrine-bundle spits out an error
Problem 1
- This package requires php >=7.0.18 but your PHP version (7.0.6) does not satisfy that requirement.
Problem 2
- Installation request for ocramius/proxy-manager 2.0.4 -> satisfiable by ocramius/proxy-manager[2.0.4].
- ocramius/proxy-manager 2.0.4 requires php 7.0.0 - 7.0.5 || ^7.0.7 -> your PHP version (7.0.6) does not satisfy that requirement.
Problem 3
- doctrine/migrations v1.5.0 requires ocramius/proxy-manager ^1.0|^2.0 -> satisfiable by ocramius/proxy-manager[2.0.4].
- doctrine/migrations v1.5.0 requires ocramius/proxy-manager ^1.0|^2.0 -> satisfiable by ocramius/proxy-manager[2.0.4].
- ocramius/proxy-manager 2.0.4 requires php 7.0.0 - 7.0.5 || ^7.0.7 -> your PHP version (7.0.6) does not satisfy that requirement.
- Installation request for doctrine/migrations v1.5.0 -> satisfiable by doctrine/migrations[v1.5.0].
I followed these instructions https://trac.macports.org/wiki/howto/InstallingOlderPort
And tracked the proper version of macports https://github.com/macports/macports-ports/commit/99a636bc52126e82187694ad73c413e22d13f68c
so I ran
git clone --single-branch https://github.com/macports/macports-ports.git
cd macports-ports
git checkout 99a636bc52126e82187694ad73c413e22d13f68c
But I still have the same version of PHP
Any help would be really appreciated.

Related

Laravel Version, PHP Version and Composer Version Compatibility Issue

I have installed PHP version 7.3.33, composer 1.1 and running multiple laravel 7.x projects.
Now I am trying to install two different Laravel Projects. One with Laravel 9 and the other with 7.x.
If I update the PHP and Composer Version, it will create issues in existing laravel 7.x projects.
Is there any way to Upgrade/ make compatible the old laravel projects to composer 2 and new PHP version.
Problem 1
- This package requires php ^8.0.2 but your PHP version (7.4.29) does not satisfy that requirement.
Problem 2
- Installation request for laravel/framework v9.1.0 -> satisfiable by laravel/framework[v9.1.0].
- laravel/framework v9.1.0 requires php ^8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 3
- Installation request for league/flysystem 3.0.8 -> satisfiable by league/flysystem[3.0.8].
- league/flysystem 3.0.8 requires php ^8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 4
- Installation request for psr/log 3.0.0 -> satisfiable by psr/log[3.0.0].
- psr/log 3.0.0 requires php >=8.0.0 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 5
- Installation request for psr/simple-cache 3.0.0 -> satisfiable by psr/simple-cache[3.0.0].
- psr/simple-cache 3.0.0 requires php >=8.0.0 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 6
- Installation request for symfony/console v6.0.3 -> satisfiable by symfony/console[v6.0.3].
- symfony/console v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 7
- Installation request for symfony/css-selector v6.0.3 -> satisfiable by symfony/css-selector[v6.0.3].
- symfony/css-selector v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 8
- Installation request for symfony/deprecation-contracts v3.0.0 -> satisfiable by symfony/deprecation-contracts[v3.0.0].
- symfony/deprecation-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 9
- Installation request for symfony/error-handler v6.0.3 -> satisfiable by symfony/error-handler[v6.0.3].
- symfony/error-handler v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 10
- Installation request for symfony/event-dispatcher v6.0.3 -> satisfiable by symfony/event-dispatcher[v6.0.3].
- symfony/event-dispatcher v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 11
- Installation request for symfony/event-dispatcher-contracts v3.0.0 -> satisfiable by symfony/event-dispatcher-contracts[v3.0.0].
- symfony/event-dispatcher-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 12
- Installation request for symfony/finder v6.0.3 -> satisfiable by symfony/finder[v6.0.3].
- symfony/finder v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 13
- Installation request for symfony/http-foundation v6.0.3 -> satisfiable by symfony/http-foundation[v6.0.3].
- symfony/http-foundation v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 14
- Installation request for symfony/http-kernel v6.0.4 -> satisfiable by symfony/http-kernel[v6.0.4].
- symfony/http-kernel v6.0.4 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 15
- Installation request for symfony/mailer v6.0.3 -> satisfiable by symfony/mailer[v6.0.3].
- symfony/mailer v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 16
- Installation request for symfony/mime v6.0.3 -> satisfiable by symfony/mime[v6.0.3].
- symfony/mime v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 17
- Installation request for symfony/process v6.0.3 -> satisfiable by symfony/process[v6.0.3].
- symfony/process v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 18
- Installation request for symfony/routing v6.0.3 -> satisfiable by symfony/routing[v6.0.3].
- symfony/routing v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 19
- Installation request for symfony/service-contracts v3.0.0 -> satisfiable by symfony/service-contracts[v3.0.0].
- symfony/service-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 20
- Installation request for symfony/string v6.0.3 -> satisfiable by symfony/string[v6.0.3].
- symfony/string v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 21
- Installation request for symfony/translation v6.0.3 -> satisfiable by symfony/translation[v6.0.3].
- symfony/translation v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 22
- Installation request for symfony/translation-contracts v3.0.0 -> satisfiable by symfony/translation-contracts[v3.0.0].
- symfony/translation-contracts v3.0.0 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 23
- Installation request for symfony/var-dumper v6.0.3 -> satisfiable by symfony/var-dumper[v6.0.3].
- symfony/var-dumper v6.0.3 requires php >=8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 24
- Installation request for nunomaduro/collision v6.1.0 -> satisfiable by nunomaduro/collision[v6.1.0].
- nunomaduro/collision v6.1.0 requires php ^8.0.0 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 25
- Installation request for spatie/flare-client-php 1.0.2 -> satisfiable by spatie/flare-client-php[1.0.2].
- spatie/flare-client-php 1.0.2 requires php ^8.0 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 26
- Installation request for spatie/ignition 1.0.5 -> satisfiable by spatie/ignition[1.0.5].
- spatie/ignition 1.0.5 requires php ^8.0 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 27
- Installation request for spatie/laravel-ignition 1.0.6 -> satisfiable by spatie/laravel-ignition[1.0.6].
- spatie/laravel-ignition 1.0.6 requires php ^8.0 -> your PHP version (7.4.29) does not satisfy that requirement.
Problem 28
- laravel/framework v9.1.0 requires php ^8.0.2 -> your PHP version (7.4.29) does not satisfy that requirement.
- laravel/sail v1.13.4 requires illuminate/console ^8.0|^9.0 -> satisfiable by laravel/framework[v9.1.0].
- Installation request for laravel/sail v1.13.4 -> satisfiable by laravel/sail[v1.13.4].
I'm on windows and how I combat this is by downloading the versions of PHP I desire and putting them inside folders that are within the same directory.
Inside parent folder I have php72 php74 php8.
Then I edit my path location in my terminal and point to that same folder however I reference the folder php.
Assuming in my directory I have php72 php74 php8 and I wish to use php8 I would rename that folder to just php
Now my directory looks like this php72 php74 php
If I need to change to php72 I would rename the directories as below
php php74 php8
I also implement a similar solution for composer
It's a bit of weird hacky way, however its easy to implement and works for me, hopefully it can for you too.
You need to create a new environment for the laravel 9 since it's not compatible with php 7. You can do it with docker Laravel sail or Virtual Machine Laravel homestead.
If you'r on a production environment, i recommend you to use another server instance or deploy in a container.
In other way, you also can use PHP-FPM with Apache / Nginx.
If you're on Local environment and don't have any knowledge of admin system / devops, you can use Laragon or Wamp and install different version of PHP
It's because in your project in composer.json file you have:
"require": {
"php": "^7.4",
.....
},
Try to update this requirement to:
"require": {
"php": "^7.4|^8.0",
.....
},
Or another option if you wouldn't to install any new version PHP you can do this. It will ignore reqs.
composer install --ignore-platform-reqs

how to remove PHP version error on deployment

I am using Xampp for local development, and I am working on the Laravel application. Everything works fine on the local server, but I am unable to deploy it. I am getting this error:
Problem 1
- Installation request for symfony/css-selector v5.0.6 -> satisfiable by symfony/css-selector[v5.0.6].
- symfony/css-selector v5.0.6 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
Problem 2
- Installation request for symfony/mime v5.0.6 -> satisfiable by symfony/mime[v5.0.6].
- symfony/mime v5.0.6 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
Problem 3
- Installation request for symfony/service-contracts v2.0.1 -> satisfiable by symfony/service-contracts[v2.0.1].
- symfony/service-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
Problem 4
- Installation request for symfony/translation-contracts v2.0.1 -> satisfiable by symfony/translation-contracts[v2.0.1].
- symfony/translation-contracts v2.0.1 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
Problem 5
- symfony/mime v5.0.6 requires php ^7.2.5 -> your PHP version (7.2.2) does not satisfy that requirement.
- symfony/http-foundation v4.4.6 requires symfony/mime ^4.3|^5.0 -> satisfiable by symfony/mime[v5.0.6].
- Installation request for symfony/http-foundation v4.4.6 -> satisfiable by symfony/http-foundation[v4.4.6].
I am using Xampp version 7.2.28 and using Laravel Envoyer for deployment. How can I solve this? Any help would be highly appreciable.
Thats becuase the version you are using locally is newer than the version of on the server. so your installing dependencies for the newer version and then trying to install on a lower version. you should make sure that your local environments match the live enviornment as much as possible, using Docker is quite handy for this.
Your possible solutions are:
Upgrade the PHP version on the live server
Downgrade the PHP version on your local to match production and adjust the dependencies accordingly
Set versions of your dependencies for the live system to compatible versions and re-install the dependencies
Downgrade your dependencies so that they can run on PHP 7.2.2 or later
The solution I would recommend is: "Downgrade your dependencies so that they can run on PHP 7.2.2 or later"
Note: I wouldn't actually recommend lowering your PHP version on the live system, but it is an option.

Composer & Plesk, encountering PHP version difficulties

Am currently attempting to get my Laravel application running behind Plesk Onyx. Now when trying to run composer install, I get the following error messages:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 2
- Installation request for symfony/css-selector v4.0.6 -> satisfiable by symfony/css-selector[v4.0.6].
- symfony/css-selector v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 3
- Installation request for symfony/event-dispatcher v4.0.6 -> satisfiable by symfony/event-dispatcher[v4.0.6].
- symfony/event-dispatcher v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 4
- Installation request for symfony/translation v4.0.6 -> satisfiable by symfony/translation[v4.0.6].
- symfony/translation v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 5
- Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 6
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
- laravel/framework v5.5.39 requires doctrine/inflector ~1.1 -> satisfiable by doctrine/inflector[v1.3.0].
- Installation request for laravel/framework v5.5.39 -> satisfiable by laravel/framework[v5.5.39].
OK. I understand the errors for sure. I run Debian 9 and "PHP by OS Vendor" is 7.0.27. However, I know that PHP 7.1+ (and even 7.2) is installed on the server, because Plesk'd let me choose (for domains and vhosts) these versions. My question now is: How can I tell composer to use a certain PHP version installed on the server, and how could this work under Debian with Plesk?
Edit: I did not install Composer globally. Just https://getcomposer.org/download/ "Command-line installation".
Here's how:
Find the PHP paths used by Plesk. In my case, this is /opt/plesk/php/. Inside this folder, there are the folders according to PHP versions installed: 7.0, 7.1, 7.2. So php composer.phar install becomes /opt/plesk/php/7.2/bin/php composer.phar install. & it works. :-)
You may use platform setting in composer.json to emulate PHP version:
"config": {
"platform": {
"php": "7.1"
}
},
Composer will assume that PHP version is 7.1 during installation and update, even if you're using 7.0 to actual install.
This will only affect Composer installation and update - if you want to run console commands of your app, you will need to use correct binary (same for web server). However setting this will make your Composer installs and updates more predictable, so it's worth doing it anyway.

Laravel not installing dependencies incorrect php version

I cannot install all the laravel dependencies because of the php version but I'm using xampp with (PHP 7.0.13) using echo phpversion(); to determine my php version but this laravel keeps telling me that I'm using php version 5.4.24 when I'm installing a new laravel directory.
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\User>cd C:\xampp
C:\xampp>laravel new htdocs
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php >=5.6.4 but your PHP version (5.4.24) does not satisfy that requirement.
Problem 2
- Installation request for classpreloader/classpreloader 3.1.0 -> satisfiable by classpreloader/classpreloader[3.1.0].
- classpreloader/classpreloader 3.1.0 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 3
- Installation request for laravel/framework v5.3.28 -> satisfiable by laravel/framework[v5.3.28].
- laravel/framework v5.3.28 requires php >=5.6.4 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 4
- Installation request for league/flysystem 1.0.32 -> satisfiable by league/flysystem[1.0.32].
- league/flysystem 1.0.32 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 5
- Installation request for nikic/php-parser v3.0.2 -> satisfiable by nikic/php-parser[v3.0.2].
- nikic/php-parser v3.0.2 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 6
- Installation request for symfony/console v3.1.8 -> satisfiable by symfony/console[v3.1.8].
- symfony/console v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 7
- Installation request for symfony/debug v3.1.8 -> satisfiable by symfony/debug[v3.1.8].
- symfony/debug v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 8
- Installation request for symfony/event-dispatcher v3.2.1 -> satisfiable by symfony/event-dispatcher[v3.2.1].
- symfony/event-dispatcher v3.2.1 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 9
- Installation request for symfony/finder v3.1.8 -> satisfiable by symfony/finder[v3.1.8].
- symfony/finder v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 10
- Installation request for symfony/http-foundation v3.1.8 -> satisfiable by symfony/http-foundation[v3.1.8].
- symfony/http-foundation v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 11
- Installation request for symfony/http-kernel v3.1.8 -> satisfiable by symfony/http-kernel[v3.1.8].
- symfony/http-kernel v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 12
- Installation request for symfony/process v3.1.8 -> satisfiable by symfony/process[v3.1.8].
- symfony/process v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 13
- Installation request for symfony/routing v3.1.8 -> satisfiable by symfony/routing[v3.1.8].
- symfony/routing v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 14
- Installation request for symfony/translation v3.1.8 -> satisfiable by symfony/translation[v3.1.8].
- symfony/translation v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 15
- Installation request for symfony/var-dumper v3.1.8 -> satisfiable by symfony/var-dumper[v3.1.8].
- symfony/var-dumper v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 16
- Installation request for phpdocumentor/reflection-common 1.0 -> satisfiable by phpdocumentor/reflection-common[1.0].
- phpdocumentor/reflection-common 1.0 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 17
- Installation request for phpdocumentor/reflection-docblock 3.1.1 -> satisfiable by phpdocumentor/reflection-docblock[3.1.1].
- phpdocumentor/reflection-docblock 3.1.1 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 18
- Installation request for phpdocumentor/type-resolver 0.2.1 -> satisfiable by phpdocumentor/type-resolver[0.2.1].
- phpdocumentor/type-resolver 0.2.1 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 19
- Installation request for phpunit/php-code-coverage 4.0.4 -> satisfiable by phpunit/php-code-coverage[4.0.4].
- phpunit/php-code-coverage 4.0.4 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 20
- Installation request for phpunit/phpunit 5.7.5 -> satisfiable by phpunit/phpunit[5.7.5].
- phpunit/phpunit 5.7.5 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 21
- Installation request for phpunit/phpunit-mock-objects 3.4.3 -> satisfiable by phpunit/phpunit-mock-objects[3.4.3].
- phpunit/phpunit-mock-objects 3.4.3 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 22
- Installation request for sebastian/code-unit-reverse-lookup 1.0.0 -> satisfiable by sebastian/code-unit-reverse-lookup[1.0.0].
- sebastian/code-unit-reverse-lookup 1.0.0 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 23
- Installation request for sebastian/environment 2.0.0 -> satisfiable by sebastian/environment[2.0.0].
- sebastian/environment 2.0.0 requires php ^5.6 || ^7.0 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 24
- Installation request for sebastian/object-enumerator 2.0.0 -> satisfiable by sebastian/object-enumerator[2.0.0].
- sebastian/object-enumerator 2.0.0 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 25
- Installation request for sebastian/resource-operations 1.0.0 -> satisfiable by sebastian/resource-operations[1.0.0].
- sebastian/resource-operations 1.0.0 requires php >=5.6.0 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 26
- Installation request for sebastian/version 2.0.1 -> satisfiable by sebastian/version[2.0.1].
- sebastian/version 2.0.1 requires php >=5.6 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 27
- Installation request for symfony/css-selector v3.1.8 -> satisfiable by symfony/css-selector[v3.1.8].
- symfony/css-selector v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 28
- Installation request for symfony/dom-crawler v3.1.8 -> satisfiable by symfony/dom-crawler[v3.1.8].
- symfony/dom-crawler v3.1.8 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 29
- Installation request for symfony/yaml v3.2.1 -> satisfiable by symfony/yaml[v3.2.1].
- symfony/yaml v3.2.1 requires php >=5.5.9 -> your PHP version (5.4.24) does not satisfy that requirement.
Problem 30
- nikic/php-parser v3.0.2 requires php >=5.5 -> your PHP version (5.4.24) does not satisfy that requirement.
- psy/psysh v0.8.0 requires nikic/php-parser ~1.3|~2.0|~3.0 -> satisfiable by nikic/php-parser[v3.0.2].
- Installation request for psy/psysh v0.8.0 -> satisfiable by psy/psysh[v0.8.0].
Application ready! Build something amazing.
C:\xampp>
Already solved. It seems that my system is using another php version from IIS Express which uses old version of the php. I just change my environment variable to point to my xampp php which has the latest php version
I had this issue just now and I fixed it by changing the Path environment variable from the operating system to point to the wamp php folder which contains the latest php version.
In order to do this (I had to research this too) - I went to this link and followed the instructions: https://www.java.com/en/download/help/path.xml
The old Path variable looked like this: C:\wamp64\bin\php\php5.6.25 and I changed it to C:\wamp64\bin\php\php7.0.10
Saved everything, closed everything, restarted my PC and then it worked with no problems.
Hope this saves some research time for someone.
You need to do one of two things.
Solution 1 - You need to update your PHP version. If you don't have the correct version, Laravel won't run correctly.
Solution 2 - Maybe you have the correct PHP version, but composer can't see that for some reason. Easy fix, you just need to use the --ignore-platform-reqs command. This will allow you to install things with composer regardless of PHP version.

Issues installing Laravel/Spark Due to System PHP Version

I'm on a new development machine, and I'm having issues installing Laravel, Spark, or just about anything that requires anything newer than PHP 5.5.30.
The problem is, I'm using MAMP Pro which IS running PHP 7.0.1. I've also tried to update my system's PHP version to PHP 7 using this tutorial: https://coolestguidesontheplanet.com/upgrade-php-on-osx/
☁ /webroot spark new app
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php >=5.6.4 but your PHP version (5.5.30) does not satisfy that requirement.
Problem 2
- Installation request for laravel/framework v5.3.20 -> satisfiable by laravel/framework[v5.3.20].
- laravel/framework v5.3.20 requires php >=5.6.4 -> your PHP version (5.5.30) does not satisfy that requirement.
Problem 3
- Installation request for phpunit/php-code-coverage 4.0.1 -> satisfiable by phpunit/php-code-coverage[4.0.1].
- phpunit/php-code-coverage 4.0.1 requires php ^5.6 || ^7.0 -> your PHP version (5.5.30) does not satisfy that requirement.
Problem 4
- Installation request for phpunit/phpunit 5.6.2 -> satisfiable by phpunit/phpunit[5.6.2].
- phpunit/phpunit 5.6.2 requires php ^5.6 || ^7.0 -> your PHP version (5.5.30) does not satisfy that requirement.
Problem 5
- Installation request for phpunit/phpunit-mock-objects 3.4.0 -> satisfiable by phpunit/phpunit-mock-objects[3.4.0].
- phpunit/phpunit-mock-objects 3.4.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.30) does not satisfy that requirement.
Problem 6
- Installation request for sebastian/code-unit-reverse-lookup 1.0.0 -> satisfiable by sebastian/code-unit-reverse-lookup[1.0.0].
- sebastian/code-unit-reverse-lookup 1.0.0 requires php >=5.6 -> your PHP version (5.5.30) does not satisfy that requirement.
Problem 7
- Installation request for sebastian/object-enumerator 1.0.0 -> satisfiable by sebastian/object-enumerator[1.0.0].
- sebastian/object-enumerator 1.0.0 requires php >=5.6 -> your PHP version (5.5.30) does not satisfy that requirement.
Problem 8
- Installation request for sebastian/resource-operations 1.0.0 -> satisfiable by sebastian/resource-operations[1.0.0].
- sebastian/resource-operations 1.0.0 requires php >=5.6.0 -> your PHP version (5.5.30) does not satisfy that requirement.
Problem 9
- Installation request for sebastian/version 2.0.0 -> satisfiable by sebastian/version[2.0.0].
- sebastian/version 2.0.0 requires php >=5.6 -> your PHP version (5.5.30) does not satisfy that requirement.
Application ready! Build something amazing.
Downloading Spark...
I don't want to just bypass the required PHP version by editing in the composer file, because I'm not sure if it's causing problems when installing apps or not. None of my Spark or Laravel installations work, they just give a 500 status error, it could be something else, but I was assuming it was this same problem.
All fixed.
Thanks #Kyslik for your suggestion.
I had previously tried updating my PATH, but for some reason it worked this time. I must have made a mistake before. For reference of anyone else having this issue, I followed this:
How to override the path of PHP to use the MAMP path?

Categories