14

I've a new server with PHP v7.1.0RC3 installed. According to DevDocs Magento 2 is compatible with 7.0.2 up to 7.1.0, except for 7.0.5 which makes PHP 7.1.0 compatible with M2 however when tried to install repo I get following error:

Problem 1 - Installation request for magento/product-community-edition 2.1.1 -> satisfiable by magento/product-community-edition[2.1.1]. - magento/product-community-edition 2.1.1 requires php ~5.6.0|7.0.2|~7.0.6 -> your PHP version (7.1.0RC3) does not satisfy that requirement.

23

Update - September 2017:

Magento 2.2 now officially supports PHP 7.1, so that's the Magento version you should aim for from now on if PHP 7.1 is something you want or need on your platform.


Original - October 2016:

I am actually wondering if the DevDocs documentation is a mistake and maybe they meant PHP 7.0.10 instead of 7.1.0, that would make more sense to me.

That being said, I guess Magento 2.1.1 could be compatible with PHP 7.1, if you want to test it, just add this additional parameter to your composer commands to tell Composer to ignore the PHP version check for the time being:

composer install --ignore-platform-reqs

Update:

After raising an issue on Github, the requirements description now has been updated to reflect that PHP 7.1 is not supported at this point. The description was indeed a typo.

  • It looked more like composer issue as fschmengler suggested below, but it's the misleading dev docs again. Downgraded to PHP version v7.0.11 and bingo. – Devtype Oct 6 '16 at 10:15
7

There are two possibilities:

  1. The devdocs are wrong and PHP 7.1 is not supported
  2. The requirement in composer.json is wrong.

Since Magento 2.1 was released before PHP 7.1, it is most likely option (2) and the requirement in composer.json has just not been updated yet.

But you can ignore it and install Magento anyways, if you add the --ignore-platform-reqs argument to your composer install command.

Update: As confirmed by https://github.com/magento/magento2/issues/7663, Magento 2.1 is not compatible with PHP 7.1

Update 2: There has been a merged PR for 7.1 compatibility that will be part of the release. See https://github.com/magento/magento2/pull/8609#issuecomment-281743983

3

disclaimer: this is a hack. use it with caution.

here is how to install and run the latest Magento 2.1.3 with php 7.1.0:

  1. patch setup/src/Magento/Setup/Model/PhpRedinessCheck.php:

    79         #$normalizedPhpVersion = $this->getNormalizedCurrentPhpVersion(PHP_VERSION);
    80         $normalizedPhpVersion = $this->getNormalizedCurrentPhpVersion('7.0.2');
    
  2. patch vendor/magento/framework/Encryption/Crypt.phpand suppress mcrypt/mdecrypt warnings with @ prefix:

    enter image description here

I tested this hack on Magento 2.1.3 sample data installation.

Originally published by me as Magento 2.1.3 on PHP 7.1.0

3

I didn't do composer install --ignore-platform-reqs just to make sure that I'm not running anything else on the server (or missing something) that's incompatible with M2.

In order to make it work I downgraded to PHP version 7.0.11 on my server and that did the trick so Magento 2.1.1 is compatible with PHP version 7.0.11 and not PHP 7.1.0

2

As of writing this the Magento version is 2.1 and it is not compatible with PHP7.1. If you try to run it with PHP7.1 you will get the following error.

See more here https://github.com/magento/magento2/issues/5880

Deprecated Functionality: Function mcrypt_module_open() is deprecated in /var/www/html/magento/vendor/magento/fr
  amework/Encryption/Crypt.php on line 54
0

You need to edit function located in

your_magento_root/setup/src/Magento/Setup/Model/PhpReadinessCheck.php

and need to add $normalizedPhpVersion='7.0.6'; line in getNormalizedCurrentPhpVersion function

The changed function needs to be

private function getNormalizedCurrentPhpVersion($version)
    {
        try {
            $normalizedPhpVersion = $this->versionParser->normalize($version);
        } catch (\UnexpectedValueException $e) {
            $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $version);
            $normalizedPhpVersion = $this->versionParser->normalize($prettyVersion);
        }
        $normalizedPhpVersion='7.0.6';
        return $normalizedPhpVersion;
    }

This will pass steps and you can use PHP7.1.4 on Magento 2.1

Cheers!!!

0

Actually, it's just a typo on the command snippet.

Change: wget https://github.com/magento/magento2/archive/2.1.tar.gz tar -xzvf 2.1.tar.gz mv magento2-2.1/ magento2/

To wget https://github.com/magento/magento2/archive/2.2.tar.gz tar -xzvf 2.2.tar.gz mv magento2-2.2/ magento2/

That's it!!!! Why downgrade, if this is a new setup. Go for the latest stable release :)!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.