Laravel - Cannot install package even though PHP version is the required one - php

I have a problem with installing some of the composer packages on my project.
Problem 1
- Installation request for spatie/image-optimizer 1.1.5 -> satisfiable by spatie/image-optimizer[1.1.5].
- spatie/image-optimizer 1.1.5 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 2
- Installation request for spatie/laravel-feed 2.2.1 -> satisfiable by spatie/laravel-feed[2.2.1].
- spatie/laravel-feed 2.2.1 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 3
- Installation request for spatie/laravel-newsletter 4.5.0 -> satisfiable by spatie/laravel-newsletter[4.5.0].
- spatie/laravel-newsletter 4.5.0 requires php ~7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 4
- Installation request for spatie/laravel-referer 1.4.0 -> satisfiable by spatie/laravel-referer[1.4.0].
- spatie/laravel-referer 1.4.0 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 5
- Installation request for spatie/laravel-sitemap 5.3.0 -> satisfiable by spatie/laravel-sitemap[5.3.0].
- spatie/laravel-sitemap 5.3.0 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
Problem 6
- spatie/image-optimizer 1.1.5 requires php ^7.2 -> your PHP version (7.1.14) does not satisfy that requirement.
- spatie/image 1.7.2 requires spatie/image-optimizer ^1.0 -> satisfiable by spatie/image-optimizer[1.1.5].
- Installation request for spatie/image 1.7.2 -> satisfiable by spatie/image[1.7.2].
Even though my PHP version is 7.2.1 these packages are not passing the composer.json validation i.e. cannot be installed. The PHP CLI version is 7.2.1 as well. (checked them all with using the standard procedures phpinfo() and php -v.
I am using MAMP PRO version 4.4.1 and the latest configurable PHP version from the listed versions is 7.2.1 (which is okay since the requirements for these packages ranges from 7.1 to 7.2.
https://github.com/spatie/image-optimizer/blob/master/composer.json#L19
https://github.com/spatie/laravel-newsletter/blob/master/composer.json#L20
https://github.com/spatie/laravel-feed/blob/master/composer.json#L33
https://github.com/spatie/laravel-referer/blob/master/composer.json#L19
https://github.com/spatie/laravel-sitemap/blob/master/composer.json#L19
As I already said the PHP versions are looking good both on the Apache side and CLI side and from the MAMP PRO GUI as well.
PHP 7.2.1 (cli) (built: Jan 15 2018 12:20:50) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
MAMP PRO config:
MAMP PRO host related config:
Upgrading PHP to version 7.3 might resolve this issue but I would like to skip that because it has to be done manual without the help of MAMP PRO (since my MAMP PRO version is licensed and I'll need another license to get the built-in PHP versions in it).
Thanks!

Not sure what would cause this except a custom version defined in your composer.json:
{
"config": {
"platform": {
"php": "7.1.14"
}
},
To work around this problem you could tell composer to ignore the version:
composer require spatie/image-optimizer --ignore-platform-reqs

Related

(Solved) Laravel New Installation - Removing PHP 7.1.23 from Mac without Brew

Solution: I've updated my OS to the latest version where the latest PHP was supported.
I've got a new laravel project
When I run php artisan serve
it shows:
MacBook-Pro% php artisan serve
Warning: require(/Users/username/Desktop/code/argon/vendor/autoload.php): failed to open stream: No such file or directory in /Users/username/Desktop/code/argon/artisan on line 18
Fatal error: require(): Failed opening required '/Users/username/Desktop/code/argon/vendor/autoload.php' (include_path='.:') in /Users/username/Desktop/code/argon/artisan on line 18
composer update shows
MacBook-Pro% composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^7.2.5 but your PHP version (7.1.23) does not satisfy that requirement.
Problem 2
- laravel/tinker v2.2.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker v2.1.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker v2.0.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/tinker 2.x-dev requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- Installation request for laravel/tinker ^2.0 -> satisfiable by laravel/tinker[2.x-dev, v2.0.0, v2.1.0, v2.2.0].
MacBook-Pro% php -v
PHP 7.1.23 (cli) (built: Nov 7 2018 18:20:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
also
MacBook-Pro% brew unlink php#7.1
Error: No such keg: /usr/local/Cellar/php#7.1
MacBook-Pro% brew unlink php71
Error: No such keg: /usr/local/Cellar/php71
also
MacBook-Pro% which php
/usr/bin/php
Any ideas how to remove php 7.1.23 ?
php -v gives the following response:
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
The release notes for Catalina contain the following remark:
Info here
Scripting Language Runtimes Deprecations Scripting language runtimes
such as Python, Ruby, and Perl are included in macOS for compatibility
with legacy software. Future versions of macOS won’t include scripting
language runtimes by default, and might require you to install
additional packages. If your software depends on scripting languages,
it’s recommended that you bundle the runtime within the app.
In short: macOS continues to include 'legacy' versions of things like Python, Ruby, Perl, and indeed PHP, so that existing code won't break, but Apple is leaving it to the user to install the versions that they want to use.
Found a solution !
brew install php72
brew switch php#7.2 7.2.25
https://laravel.com/docs/6.x/homestead

Silverstripe Core upgrade from 3.5.6 to 3.6.6

I have a website built on Silverstripe 3.5.6 and I need to update it to 3.6.6 because it has php 7.0.
The documentation is very twisted and I don't understand anything. Basically what I tried was to open composer.json and change framework,cms versions from 3.5.6 to 3.6.6 and then via Terminal launch the "composer update" command, and I tought this will load the corresponding versions, but I get this error back:
- Installation request for silverstripe/framework 3.6.6#stable -> satisfiable by silverstripe/framework[3.6.6].
- silverstripe/framework 3.6.6 requires php >= 5.3.3, <7.2 -> your PHP version (7.2.11) does not satisfy that requirement.
Problem 2
- Installation request for silverstripe/reports 3.6.6#stable ->
satisfiable by silverstripe/reports[3.6.6].
- silverstripe/reports 3.6.6 requires php >=5.3.3,<7.2 -> your PHP
version (7.2.11) does not satisfy that requirement.
Problem 3
- silverstripe/framework 3.6.6 requires php >= 5.3.3, <7.2 -> your PHP
version (7.2.11) does not satisfy that requirement.
- silverstripe/display-logic 1.5.0 requires silverstripe/framework
^3.1
-> satisfiable by silverstripe/framework[3.6.6].
- Installation request for silverstripe/display-logic 1.5.0 -> satisfiable by silverstripe/display-logic[1.5.0].
From the log you posted:
silverstripe/framework 3.6.6 requires php >= 5.3.3, <7.2 -> your PHP
version (7.2.11) does not satisfy that requirement.
Silverstripe 3.x (prior to 3.7.0) only supports PHP 7 versions before 7.2. If you want to use PHP 7.2, you will need to upgrade to SilverStripe 3.7+ or Silverstripe 4.x.

Latest Laravel and latest WAMP issues

I have them both vanilla setup. Laravel setups up fine. But when i run composer install i get;
> Problem 1
- This package requires php ^7.1.3 but your PHP version (7.0.11) does not satisfy that requirement.
Problem 2
- 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.11) does not satisfy that requirement.
Problem 3
....
Problem 24
- Installation request for sebastian/diff 3.0.1 -> satisfiable by sebastian/diff[3.0.1].
- sebastian/diff 3.0.1 requires php ^7.1 -> your PHP version (7.0.11) does not satisfy that requirement.
Problem 25
- laravel/framework v5.6.26 requires php ^7.1.3 -> your PHP version (7.0.11) does not satisfy that requirement.
- laravel/tinker v1.0.7 requires illuminate/console ~5.1 -> satisfiable by laravel/framework[v5.6.26].
- Installation request for laravel/tinker v1.0.7 -> satisfiable by laravel/tinker[v1.0.7].
A total of 25 problems when running composer on laravel...
I have understood so much my php version differs in minor version, but what can i do to fix it?
Thanks!
I think your laravel version wants php version >= 7.1.3 but your installed version is 7.0.11.
If you have installed latest laravel version i.e(5.6) then it should match following requirements:
PHP >= 7.1.3
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension
Please check laravel installation guide https://laravel.com/docs/5.6/installation#installation
Yea, there where mismatches in version. Strangley enough i downloaded another phpversion 7.2.xx. And it almost worked like a charm. They have some strange things going on eg. the extensions config directive s never prefixed with "php_" in the ini file and it is very easy to miss, so you will need to add it yourswelf also there are no extension dir config by default, you also need that one. Its commented out, another workhour to find this this.
Thanks for your reply!

Laravel 5.5. and PHP 7

I am updating to Laravel 5.5. which uses PHP 7.0 version. I need to do setup on my local machine and on AWS as well. First, locally WAMP server is installed which comes with PHP 7.0 ... I've selected it and when localhost is opened I get the message that the PHP version is 7.0.10 ... After changing version numbers for Laravel and PHP in composer.json, I did update and got this message:
Problem 1
This package requires php >=7.0 but your PHP version (5.6.25) does not satisfy that requirement. Problem 2
laravel/framework v5.5.2 requires php >=7.0 -> your PHP version (5.6.25) does not satisfy that requirement.
laravel/framework v5.5.1 requires php >=7.0 -> your PHP version (5.6.25) does not satisfy that requirement.
laravel/framework v5.5.0 requires php >=7.0 -> your PHP version (5.6.25) does not satisfy that requirement.
Installation request for laravel/framework 5.5.* -> satisfiable by laravel/framework[v5.5.0, v5.5.1, v5.5.2].
It is written that I still use 5.6. How can I change this?
According to #iainn Apache is using PHP 7, but the CLI (which Composer uses) is still using 5.6 hence, trying to uninstall and install composer again and select the correct php version (7.0) while setup. Check below screenshot
You're getting an error from composer. Try using
'composer install --ignore-platform-reqs'
to setup your project folder.
Just change varible enviroment on your computer
add path php you would you like to use

yii2 : xampp upgrade to php7

I have a new project in yii2, I downloaded yii2 using composer and when I try to download the extension it tells me to upgrade my PHP from 5 to 5.6 or higher. Then I upgraded it to 7.1.3 the old projects works fine and the phpMyAdmin too afterwards I tried to install the extension again. It gives me the same message.
Problem 1
sebastian/version 2.0.1 requires php >=5.6 -> your PHP version (5.5.34) does not satisfy that requirement.
sebastian/version 2.0.1 requires php >=5.6 -> your PHP version (5.5.34) does not satisfy that requirement.
Installation request for sebastian/version (installed at 2.0.1) -> satisfiable by sebastian/version[2.0.1].
What is wrong here?

Categories