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
Related
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.
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.
Hello after I installed Laravel,
I try to update the version 5.5 to 5.6 and unable to throws me an error:
- laravel/framework v5.6.9 requires php ^7.1.3 -> your PHP version (7.0.10) does not satisfy that requirement.
I use XAMPP with PHP 7.2.10.
I installed Composer with php 7 And does not help.
Thanks
Have a look at your composer.json. It is possible that there is a configuration parameter config.platform.php which contains the value 7.0.10. This feature allows to simulate a specific PHP version to composer. If you don't need it, you can remove it or force composer to install anyway by using the --ignore-platform-reqs parameter when updating the packages.
If you are on Linux Debian, you can easily install the latest version of php with sudo apt-get install php x.x. On windows, this link might help. Then, try installing or upgrading Laravel from cmd and it should work sweet! Re-installing the latest verion of XAMPP may also do the work for you.
You have to update your system's PATH environment variable so that it finds the newer version of php from your command line. You might have more than one installed right now, so it uses the first one it finds when it looks through the directories defined in your PATH. After updating the path variable, you might have to log out for it to apply.
You can check the version used by your command line with php --version. To see which version Apache is configured with, use phpinfo().
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
I installed phpbrew to use php 5.4 in Ubuntu 14.04. It works fine, except when I try to use composer, which ignores phpbrew and installs dependencies related to php 5.5.
Is there a way to force composer to be compatible with phpbrew config?
I trying to add: php: "5.4" in my composer.json, but it says that this requirement is not possible with my php version.
You can easy install composer with phpbrew by following command:
$ phpbrew app get composer
Source: https://github.com/phpbrew/phpbrew Section: Installing Extra Apps
I was getting an error as app is not a valid command. To fix this, I used brew install composer.