noorr_swati
(Nooralamswati91)
1
i am using geoip http://www.yiiframework.com/extension/geoip/ and my database file is in extension/database/GeoLiteCity.dat i am accessing it as
'components'=>array(
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
),
'geoip' => array(
'class' => 'application.extensions.geoip.CGeoIP',
// specify filename location for the corresponding database
'filename' => '/protected/extensions/database/GeoLiteCity.dat',
// Choose MEMORY_CACHE or STANDARD mode
'mode' => 'STANDARD',
),
but when i run it give the error
fopen(/protected/extensions/database/GeoLiteCity.dat): failed to open stream: No such file or directory
what i am doing wrong guide me plzz
Srsly, guys, why do you hate to read error messages?..
fopen(/protected/extensions/database/GeoLiteCity.dat): failed to open stream: No such file or directory
I’m pretty sure you have no /protected folder (you have something like /var/www/yourapp/protected instead)
Obviously you should set the correct path to the file (either set to full unix path or add yii’s aliases to dirs)
noorr_swati
(Nooralamswati91)
3
i also tried this
'geoip' => array(
'class' => 'application.extensions.geoip.CGeoIP',
// specify filename location for the corresponding database
'filename' => Yii::app()->baseUrl.'/protected/extensions/database/GeoLiteCity.dat',
// Choose MEMORY_CACHE or STANDARD mode
'mode' => 'STANDARD',
),
but it giving the error
Fatal error: Call to a member function getBaseUrl() on a non-object in E:\xampp\htdocs\yii\framework\base\CApplication.php on line 560
phtamas
(Phtamas)
4
Configuration is parsed before instantiation of CWebApplication.
Also Yii::app()->getBaseUrl() returns a web URL but you need a filesystem path.
Try DIR (or dirname(FILE) for older versions of PHP).