![](/img/trans.png)
[英]GeoIP (GeoLite2-Country.mmdb) IPv6 less database records: 800k+ (8th of July 2015 12:42:20) to 320k+ (3rd of September 2015 03:07:26)
[英]The file GeoLite2-Country.mmdb does not exist or is not readable
我在一個小項目中,我需要收集向一個站點提交聯系表的國家/地區表單的人,現在我正在使用MaxMind / GeoLite2通過GeoIp2 v2.0 (從作曲家安裝)讀取數據庫文件,並且下一條錯誤消息。
文件GeoLite2-Country.mmdb不存在或不可讀。
我正在使用CodeIgniter v3.1.6
這是完整的錯誤消息:
An uncaught Exception was encountered
Type: InvalidArgumentException
Message: The file "http://localhost/isite/assets/geoip2db/GeoLite2-Country.mmdb" does not exist or is not readable.
Filename: C:\xampp\htdocs\isite\vendor\maxmind-db\reader\src\MaxMind\Db\Reader.php
Line Number: 48
Backtrace:
File: C:\xampp\htdocs\isite\vendor\geoip2\geoip2\src\Database\Reader.php
Line: 53
Function: __construct
File: C:\xampp\htdocs\isite\application\controllers\Main.php
Line: 28
Function: __construct
File: C:\xampp\htdocs\isite\index.php
Line: 317
Function: require_once
那里有GeoLite2-Country.mmdb文件。
這是我稱之為GeoIp2類的函數:
public function contact_submit(){
$reader = new GeoIp2\Database\Reader(base_url().'assets/geoip2db/GeoLite2-Country.mmdb');
$record = $reader->country($_SERVER['REMOTE_ADDR']);
$data = array(
'name' => $this->input->post('name'),
'mail' => $this->input->post('mail'),
'phone' => $this->input->post('phone'),
'comment' => $this->input->post('comment'),
'USER_AGENT' => $_SERVER['HTTP_USER_AGENT'],
'ADDR' => $_SERVER['REMOTE_ADDR'],
'PORT' => $_SERVER['REMOTE_PORT'],
'ISO' => $record->country->isoCode,
'COUNTRY_NAME' => $record->country->name,
'COUNTRY_STATE' => $record->mostSpecificSubdivision->name,
'COUNTRY_STATE_ISO' => $record->mostSpecificSubdivision->isoCode,
'CITY_NAME' => $record->city->
'POSTAL_CODE' => $record->postal->code,
'LONGITUDE' => $record->location->longitude,
'LATITUDE' => $record->location->latitude
);
if($this->MainModel->submitComment($data))
redirect(base_url().'index.php/main/contact?statusMessage=1', 'location');
else
redirect(base_url().'index.php/main/contact?statusMessage=0', 'location');
}
如果需要更多信息,請發表評論,我會盡快添加
構造函數采用本地數據庫文件的路徑,但是您似乎在為其提供HTTP URI。 您需要刪除或替換base_url()
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.