Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxmind db not exist or readable #5

Closed
unizhu opened this issue Aug 16, 2015 · 4 comments
Closed

maxmind db not exist or readable #5

unizhu opened this issue Aug 16, 2015 · 4 comments

Comments

@unizhu
Copy link

unizhu commented Aug 16, 2015

hey ,

I tried to use

$geoip = new GeoIP([
            'driver' => 'maxmind',
            'maxmind' => [
                'database' => public_path('geoip/geoip.mmdb'),
            ],
 ]);

and Laravel returns

The file "/var/www/html/test/public/geoip/geoip.mmdb" does not exist or is not readable.
 in Reader.php line 46
at Reader->__construct('/var/www/html/test/public/geoip/geoip.mmdb') in Reader.php line 52
at Reader->__construct('/var/www/html/test/public/geoip/geoip.mmdb') in MaxmindDriver.php line 116
at MaxmindDriver->createDatabase() in MaxmindDriver.php line 72
at MaxmindDriver->create() in MaxmindDriver.php line 25
at MaxmindDriver->__construct(array('database' => '/var/www/html/test/public/geoip/geoip.mmdb')) in GeoIPManager.php line 70
at GeoIPManager->createMaxmindDriver(array('database' => '/var/www/html/test/public/geoip/geoip.mmdb')) in GeoIPManager.php line 40
at GeoIPManager->getDriver() in GeoIP.php line 34
at GeoIP->__construct(array('driver' => 'maxmind', 'maxmind' => array('database' => '/var/www/html/test/public/geoip/geoip.mmdb'))) in TimeslotController.php line 314

However , the db exists and readable:

ls -la /var/www/html/test/public/geoip/geoip.mmdb
-rwxrwxrwx. 1 apache apache 32415987 Jul  8 19:50 /var/www/html/test/public/geoip/geoip.mmdb
@pulkitjalan
Copy link
Owner

very strange, maybe trying running the update command to update the database file

@pulkitjalan
Copy link
Owner

Also can you check the exception type. A PulkitJalan\GeoIP\Exceptions\InvalidDatabaseException is thrown if the database is corrupt or invalid. If it is this one then again running the update command should fix it.

@unizhu
Copy link
Author

unizhu commented Aug 17, 2015

@pulkitjalan Thanks.
I think it's maybe another program https://github.com/Torann/laravel-geoip has changed the database , so when I remove it from composer.json and start to use pulkitjalan\geoip , pulkitjalan\geoip cannot read this file properly .
my solution is re-download the database from geolite.maxmind.com , replace the database and pulkitjalan\geoip works!

suggestion: maybe you can add some validations and throw the database formatting exception rather than file not found or try to update the database automatically :)

@pulkitjalan
Copy link
Owner

great thanks, yea will see about improving it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants