Loading..
Processing... Please wait...

Product was successfully added to your shopping cart.



[SOLVED] Magento 2.1.3 on PHP 7.1.0

Here is how to install and run the latest Magento 2.1.3 on the latest PHP 7.1.0.

Disclaimer: although this hack is tested on the default Magento 2.1.3 sample data installation use this with caution for production sites. always test test test!

 

1. Patch installation files

Magento 2.1.3 checks php version and refuses to install with php 7.1.0. Let's bypass it.

Open up setup/src/Magento/Setup/Model/PhpRedinessCheck.php and change line 79

from:

$normalizedPhpVersion = $this->getNormalizedCurrentPhpVersion(PHP_VERSION);

to:

$normalizedPhpVersion = $this->getNormalizedCurrentPhpVersion('7.0.2');

 

2. Suppress mcrypt warnings

Edit vendor/magento/framework/Encryption/Crypt.php and prefix all mcrypt/mdecrypt functions with @ :

@mdecrypt_generic

here is a diff file:

 

 

54c54
<         $this->_handle = @mcrypt_module_open($cipher, '', $mode, '');
---
>         $this->_handle = mcrypt_module_open($cipher, '', $mode, '');
56c56
<             $maxKeySize = @mcrypt_enc_get_key_size($this->_handle);
---
>             $maxKeySize = mcrypt_enc_get_key_size($this->_handle);
62c62
<             $initVectorSize = @mcrypt_enc_get_iv_size($this->_handle);
---
>             $initVectorSize = mcrypt_enc_get_iv_size($this->_handle);
80c80
<             @mcrypt_module_close($this->_handle);
---
>             mcrypt_module_close($this->_handle);
83c83
<         @mcrypt_generic_init($this->_handle, $key, $initVector);
---
>         mcrypt_generic_init($this->_handle, $key, $initVector);
93,94c93,94
<         @mcrypt_generic_deinit($this->_handle);
<         @mcrypt_module_close($this->_handle);
---
>         mcrypt_generic_deinit($this->_handle);
>         mcrypt_module_close($this->_handle);
138c138
<         return @mcrypt_generic($this->_handle, $data);
---
>         return mcrypt_generic($this->_handle, $data);
152c152
<         $data = @mdecrypt_generic($this->_handle, $data);
---
>         $data = mdecrypt_generic($this->_handle, $data);

clear cache:

rm -rf var/cache/*
rm -rf var/generation/*

and enjoy!

 

 

If you find this post interesting do not hesitate to sign up for our newsletter and join the 639 people who receive Magento news, tips and tricks regularly.

Thank You!