magento-2-geoip-library icon indicating copy to clipboard operation
magento-2-geoip-library copied to clipboard

GeoIP Configuration "Download Library" button fails on Magento 2.3.1

Open Hailong opened this issue 6 years ago • 9 comments

It fails when unzipping the downloaded GeoLite2-City.tar.gz because the phar wrapper is unregistered in the beginning of /app/bootstrap.php script. The code snippet is below:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * Environment initialization
 */
error_reporting(E_ALL);
stream_wrapper_unregister('phar');
#ini_set('display_errors', 1);

Hailong avatar May 24 '19 21:05 Hailong

Can't download file. Please try again! RecursiveDirectoryIterator::__construct(): Unable to find the wrapper "phar" - did you forget to enable it when you configured PHP?

loid345 avatar Jun 10 '19 19:06 loid345

My current workaround for this issue is to use a package named Zippy, while a problem of this package is that we need to take its master branch at this moment, because its latest release branch doesn't work for me. Here is the code change for reference.

Hailong avatar Jun 10 '19 20:06 Hailong

Also experiencing this on 2.2.8

Quintenps avatar Jun 24 '19 12:06 Quintenps

Please try to edit the unregister 'phar' to #stream_wrapper_unregister('phar'); Then let's try to download the Geo IP library.

You can remove the # symbol after downloading successfully.

DrakeJack avatar Jul 29 '19 02:07 DrakeJack

Hi @DrakeJack , since Magento had decide to unregister it in there code, I mean if we could fix it from the module code?

As I mentioned, I just tried Zippy, and it works fine for me.

Hailong avatar Jul 29 '19 04:07 Hailong

The latest version of Zippy didn't work for me. I just used shell_exec() to unzip the file. I know it's not a very good solution, but it works.

ArnoVDC avatar Sep 04 '19 12:09 ArnoVDC

You can tag 2.3.2 with the same issue.

raidoa avatar Oct 07 '19 10:10 raidoa

can confirm problem on 2.3.2 with 1.0.4

itsolon avatar Oct 07 '19 13:10 itsolon

using below code

stream_wrapper_restore('phar');

just above line# 95 [$phar = new \PharData($path . '/GeoLite2-City.tar.gz');] of file Controller/Adminhtml/System/Config/Geoip.php will solve the problem.

I want to create pull request for this change but unfortunately, this module asks for 2 other modules Mageplaza_Core & Mageplaza_Backend to run and I couldn’t find those modules.

rav-redchamps avatar Nov 07 '19 17:11 rav-redchamps