PDA

View Full Version : فعال کردن Gii



tux-world
یک شنبه 24 آذر 1392, 09:49 صبح
سلام. من یه پروژه کوچیک ایجاد کردم ولی نمیتونم توش gii رو استفاده کنم. تو تنظیمات فعالش کردم ولی وقتی تو آدرس بار میزنم خطا میده.

من فایل رو ضمیمه کردم. ممنون میشم راهنمایی کنید.


http://localhost/yii/demos/helloworld/index.php?r=gii

Unable to resolve the request "gii".


The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

2013-12-15 10:30:24






113972

MMSHFE
یک شنبه 24 آذر 1392, 10:38 صبح
باید قبلش ماژول مربوط به Gii رو توی فایل تنظیمات اصلی (protected/config/main.php) فعال و تنظیم کنید:


...
'modules' => array(
....
'gii' => array(
'class' => 'system.gii.GiiModule',
'password' => '********',
'ipFilters' => array('127.0.0.1', '::1'),
),
...
),
....

tux-world
یک شنبه 24 آذر 1392, 10:45 صبح
همونطور که گفتم فعالش کردم.


<?php
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',

'import'=>array(
'application.models.*',
'application.components.*',
),
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'a',
'ipFilters'=>array('127.0.0.1','::1'),
),
),
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=exam1',
'emulatePrepare' => true,
'username' => 'root',
'password' => 'a',
'charset' => 'utf8',
),
'errorHandler'=>array(
'errorAction'=>'site/error',
),

);

nariman_t
یک شنبه 24 آذر 1392, 10:51 صبح
یه پروژه دیگه بسازید و ببینید باز هم همین مشکل رو دارید؟

MMSHFE
یک شنبه 24 آذر 1392, 10:56 صبح
توی لینوکس کار میکنید یا ویندوز؟

tux-world
یک شنبه 24 آذر 1392, 11:06 صبح
من تو لینوکس کار میکنم. فایل رو هم اتچ کردم میتونید دانلود کنید ببینید؟ تو پروژه های دیگه مشکلی ندارم. این پروژه از بیس هستش فکر کنم مشکلی تو فایلها و این چیزها باشه.

MMSHFE
یک شنبه 24 آذر 1392, 11:21 صبح
این تغییرات رو توی پروژه باید اعمال کنید:
index.php


<?php

// change the following paths if necessary
$yii=dirname(__FILE__).'/../../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';

require_once($yii);
Yii::createWebApplication($config)->run();

توضیح: مسیر تنظیمات رو باید مشخص کنید تا برنامه بتونه اونها رو بخونه.

config/main.php


<?php
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'My Web Application',

'import'=>array(
'application.models.*',
'application.components.*',
),
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>false,
'ipFilters'=>array('127.0.0.1','::1'),
),
),
'components'=>array(
'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=exam1',
'emulatePrepare' => true,
'username' => 'a',
'password' => 'ncis',
'charset' => 'utf8',
),
'errorHandler'=>array(
'errorAction'=>'site/error',
),
),
);

توضیح: db یک عنصر از آرایه components باید باشه.
من این کارها رو انجام دادم، Gii اجرا شد. لطفاً تست کنید.