Upgrading php to 8 - php

Both my valet and composer is using php 8.0
But my local says
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2". You are running 7.4.30. in /Users/admin/sites/sage10/web/app/themes/sage10/vendor/composer/platform_check.php on line 24
When I upgrade php with valet using 8.0 it gives
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/admin/.composer/vendor/illuminate/container/Container.php
But at the end it says its using 8.0. and composer -vvv about also gives php 8.0
Is there more things to consider? I don't understand why its saying I'm using 7.4...

Composer works on the php version is in use on command line. It is possible you have multiple version installed.
Try to run
php -v
Then ensure composer is updated to the latest version (2.4.2)
composer -V
In case update it
composer self-update
If self-update gives you some runtime error, reinstall composer following the install procedure
Then the error you get is about Laravel 6/7/8 version with PHP 8, the solution is here
Laravel app stopped working after upgrading to php 8

I had a line of required package that was not needed and supported with sage 10// php8 (illuminate/support) inside my global composer file. After erasing that and linking my valet with php database and restarting it, everything started to work.

Related

Composer 2.3.0 dropped support for PHP less than 7.2.5 and you are running 7.1.33

Facing issue after downgrade the PHP version with updated version of composer,
I am trying to doing upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2 which option is given by CMD.
I tried myself with downgrade the PHP version using the Command of brew but I tried to get the solution for composer, Either it's possible to downgrade or upgrade the version of composer same like PHP.

How to change php version in composer dependencies

when I try to run a server on mamp i get the error message: "Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.8".
You don't change package dependencies, that's the responsibility of the package maintainer. Either see if there is another version available that requires the same or lower version of PHP than you have installed in your environment or install the required PHP version.
It appears that MAMP Pro has support for PHP 8.1 although this question seems to have a solution without requiring the Pro version.

Tell composer which PHP version to use

I have two projects running php7.0 and 5.6. Now the default version of php cli is 7.0. I need to run composer-update on project 5.6 but the composer is reading php7.0 so it will throw an error since there are features that only compatible in 5.6. Is there a way to tell composer which version to use during composer-install and composer-update without changing the default php-cli?
Yes, you just have to specify which PHP version to use by directly calling the intended PHP bin file.
So, instead of
php composer.phar update
You have to use something like
/path/to/php5.6/bin/php composer.phar update
In my case, on a CentOS server with Plesk (default PHP version was 5.4, but I also had 5.6 and 7.0 installed), I had to use :
/opt/plesk/php/5.6/bin/php composer.phar update

Php version error when install composer

I want to run composer on my shared hosting. When I install it, I have php version problem. It needs minumum version of 5.5. Then, my version seems 5.4. To solve it, I can siwtch it on Cpanel; however, there is no change from command line.
As a result, I don't have root privilege and I should switch php version from 5.4 to 5.5. What I should do to install composer?
I solved the problem. Composer will be installed with this command smoothly:
php [your composer.phar path] --install-dir

PHP Composer Not Working On Mac

I have installed a bitnami mac stack mainly because I require at least PHP 5.4.7 version for my project. However, I have run into an issue with composer. This is the error I get when I run:
php composer.phar install --dev
The error:
Richard-Knops-MacBook-Pro:my-project richardknop$ php composer.phar install --dev
dyld: Library not loaded: /Applications/MAMP/Library/lib/libiconv.2.dylib
Referenced from: /opt/local/bin/php
Reason: Incompatible library version: php requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
Trace/BPT trap
Richard-Knops-MacBook-Pro:my-project richardknop$
How to solve it?
Update your mamp installation the error clearly says that your libiconv.2.dylib is outdated.
If MAMP has no more-to-date version install apache + php via. mac-ports.
BitNami is self-contained and doesn't modify your system environment. I think that the problem was that the BitNami environment was not loaded.
Referenced from: /opt/local/bin/php
That doesn't seem to belong to a BitNami installation. For future reference the solution (I think) would have been:
Load the BitNami environment executing /Application/mampstack-5.4.x/use_mampstack
After that make sure that the environment is loaded correctly executing which php
Then execute php composer.phar install --dev

Categories