Torann / laravel-geoip

Determine the geographical location of website visitors based on their IP addresses.
http://lyften.com/projects/laravel-geoip
BSD 2-Clause "Simplified" License
2.11k stars 372 forks source link

Can't get it to work with Laravel 5.1 #42

Closed rgcouto closed 9 years ago

rgcouto commented 9 years ago

Hi everyone,

I'm having some trouble in setting this up with Laravel 5.1 on a live server, I'm always getting the output below. I've already installed https://github.com/maxmind/MaxMind-DB-Reader-php but still can't get it to work properly.

Any help would be appreciated. Thanks.

RuntimeException in Decoder.php line 259:
The gmp or bcmath extension must be installed to read this database.
in Decoder.php line 259
at Decoder->decodeBigUint('V9=�', '4') in Decoder.php line 132
at Decoder->decodeByType('uint64', '38296851', '4') in Decoder.php line 98
at Decoder->decode('38296849') in Decoder.php line 194
at Decoder->decodeMap('9', '38296778') in Decoder.php line 105
at Decoder->decodeByType('map', '38296778', '9') in Decoder.php line 98
at Decoder->decode('38296777') in Reader.php line 65
at Reader->__construct('/var/www/ubicoding/frontend/releases/20151104205426/storage/app/geoip.mmdb') in Reader.php line 52
at Reader->__construct('/var/www/ubicoding/frontend/releases/20151104205426/storage/app/geoip.mmdb') in GeoIP.php line 181
at GeoIP->locate_maxmind('84.90.35.43') in GeoIP.php line 158
at GeoIP->find(null) in GeoIP.php line 119
at GeoIP->getLocation() in Facade.php line 211
at Facade::__callStatic('getLocation', array()) in StatisticsLibrary.php line 33
at GeoIPFacade::getLocation() in StatisticsLibrary.php line 33
at StatisticsLibrary::addStatistic(null, 'public', 'show', 'home') in HomeController.php line 32
at HomeController->index()
at call_user_func_array(array(object(HomeController), 'index'), array()) in Controller.php line 256
at Controller->callAction('index', array()) in ControllerDispatcher.php line 164
at ControllerDispatcher->call(object(HomeController), object(Route), 'index') in ControllerDispatcher.php line 112
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
at ControllerDispatcher->callWithinStack(object(HomeController), object(Route), object(Request), 'index') in ControllerDispatcher.php line 69
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\HomeController', 'index') in Route.php line 203
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 704
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 706
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 671
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 55
rgcouto commented 9 years ago

Already solved, just installed gmp and bcmath to get it to work. Installing the maxminddb extension didn't solved it for me.

yum install php-gmp
yum install php-bcmath
service httpd restart

For anyone with the same issue, this should do the trick.