Cant install Magento 2 - php

I can't install Magento 2 on Server https://prnt.sc/tqrb6n
By trying to do command composer install. Maybe some one how. How to fix this issue.
[root#junisoft junisoft.ru]# composer instal
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 ~7.3.0||~7.4.0 but your PHP version (7.1.28) does not satisfy that requirement.
Problem 2
- Installation request for magento/composer 1.6.0 -> satisfiable by magento/composer[1.6.0].
- magento/composer 1.6.0 requires php ~7.3.0||~7.4.0 -> your PHP version (7.1.28) does not satisfy that requirement.

It seems that problem is with your current php version. it would require your php7.3 version to install magento
You can verify that your current php version by below command.
php -v
it will display the current PHP version.
You can change command-line PHP version by below command
update-alternatives --config php
in your case to resolve above error change it to php7.3 if require you can prefix the command with the sudo access rights.
for webversion php change you can run
a2enmod php7.*
replace 7.* with the version you required and after that restart apache or ngix services
incase of apache 2 you can run below command also
/etc/init.d/apache2 restart
if require sudo privilege you can run the command with the sudo access.
Note: For some server related operation please make sure to run this command with some knowledge or you can also ask server admin help to configure the same.

Try with the below way,
Use --ignore-platform-reqs
for example :- composer install --ignore-platform-reqs
it's will ignore platform requirement problem like php version and etc etc.
Thanks.

Your installed PHP version 7.1.* is not compatible with the Magento 2 version you are trying to install. The Magento 2 version that you want to install is looking for PHP 7.3.* or PHP 7.4.* which is not there on the server.
The very first line of the error statement clearly says that your PHP version is not compatible with the Magento 2 version you are trying to install.
You need to contact your Hosting service provider to update your PHP to the required version which is PHP7.3.* or PHP7.4.*. Only after updating your PHP, you will be able to install the Magento 2 version which is mentioned in your composer.json file.
I found one similar article here https://technicallysound.in/magento-2-upgrade-and-composer-issues/. This explains about composer incompatibility issue with the extensions you are trying to install via Composer.

Related

I cant install phpspreadsheet using composer

I am trying to make an import excel data to mysql using php and trying to install composer require phpoffice/phpspreadsheet
but the error below always appear.
Installation failed, deleting ./composer.json.
In RequireCommand.php line 217:
No composer.json present in the current directory (./composer.json), this may be the cause of the following exception.
In PackageDiscoveryTrait.php line 313:
Package phpoffice/phpspreadsheet has requirements incompatible with your PHP version, PHP extensions and Composer version:
- phpoffice/phpspreadsheet 1.25.2 requires ext-zip * but it is not present.
At First, I thought i was because of my php version. I am running xampp with php 7.3 on my macOs. it didnt work.
I try to install it in my windows PC which run php 7.4 and it work just fine.
So I remove my 7.3 version and install the 7.4 version into my mac. and it didnt work either.
There is no compomposer.json in the directory.
When starting a new project, you should at first run
composer init
It will do some question to initialize the value in composer.json, which basically are the same you can pass as parameter to the command: https://getcomposer.org/doc/03-cli.md#init
After that you can run composer to install package
avoid using same name in folder and before installation use composer init

How to downgrade PHP version (Your PHP version does not satisfy that requirement)?

After running sudo apt-get update && sudo apt-get dist-upgrade on my Laravel app, I'm getting this error on the next deployment:
- This package requires php ^7.1.3 but your PHP version (8.1.6) does not satisfy that requirement.
In my composer.json, ^7.1.3 is the specified version. This is my first time running the apt-get update and I don't know why the php version got updated as well.
On each deployment I run
composer install --no-interaction --prefer-dist --optimize-autoloader
How can I downgrade the version to 7.1.3? This happens on an existing app in production and I have to be very careful about it.
The php version installed on your environment should be compatible with your project.
If your project is based on composer package manager (as I see), it can help you to control which php version you need on the server.
In your case I would recommend to restore from the snapshot or just install php 7.1.3 version back.
If you want to use php 7.4/8/8.1 in your project, before you should upgrade your code and project dependencies and ensure, that everything working fine with the desired version of php.
Old topic, but for things like this, I recommend adding the flag to ignore requirements like this. So try:
composer install --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-reqs
There may be incompatibilities with your project using 8.1 instead of 7.1.3, but I doubt it. But still, only do this if you feel confident the PHP version won't be an issue. It's usually better than downgrading, however.

Laravel on Linux: Create new project Error: Your requirements could not be resolved to an installable set of packages

I have a problem installing laraval on openSUSE. I have done it like in this documentation: https://en.opensuse.org/Laravel
But when I run the command:
laravel new myproject
I got these error messages:
Terminal Error Messages
I'm quite new to Linux and laravel (some experiences), but I don't know what to do now. The error message gives me some problems, but I don't know how to fix that. Maybe someone can help me.
I'm running:
openSUSE Leap 15.3
php version 7.4.6
composer version 2.1.6
The error message indicates that the php fileinfo extension is not installed.
In openSUSE, this is the command you need to type: sudo zypper install php-fileinfo.
It could also be sudo apt install php-fileinfo if you were using a Debian based distribution (might be useful for other people).
You can also specify the version by typing sudo zypper install php7.4-fileinfo, where you can change 7.4 to any available version (typically from 5.6 to 8.0 at the time this is written).
After fileinfo is installed, you might encounter a similar error, but for another extension. Look at the message, the missing extension will be mentioned and you will be able to install it by repeting what you just did with fileinfo (for instance, sudo zypper install php-zip).

Upgrade laravel

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().

Laravel project creation, Your requirements could not be resolved to an installable set of packages

I'm trying to create a project using a composer. I use the following command. My folder consist of another project but in a separate folder.
composer create-project --prefer-dist laravel/laravel blog
The error I get is,
Your requirements could not be resolved to an installable set of packages.
Some answers in Stackoverflow says to upgrade the PHP. But in my case it's already updated to newest version. php -v says,
Is there any solution? Any suggestion is warmly welcome.
Edit: I installed the php mbstring but I get the same error.
If you're running PHP 5
sudo apt-get install php5-mbstring
If you're running PHP 7
sudo apt-get install php7.0-mbstring
Also, read Laravel's requirements: https://laravel.com/docs/5.4/installation
There may be other dependencies you haven't installed:
PHP >= 5.6.4
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension

Categories