Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii PHP Framework- Implementation

Tags:

php

yii

I was just curious if Yii is supposed to be compiled into PHP or not. Is it possible to use Yii just by copying the Framework to a folder on the server and then including something (something as in one of the yii files- I am not sure how it works) in the scripts I wish to use the framework for?

(Noob when it comes to frameworks and usage)

Thanks, Josh

like image 917
Joshua Enfield Avatar asked Sep 29 '26 18:09

Joshua Enfield


1 Answers

I'll go with the line

Is it possible to use Yii just by copying the Framework to a folder on the server and then including something

and answer yes :p Though, you should just follow webapp creation through yiic webapp like so:

  1. Download the yii (yii-someversion.tar.gz or what have you) distribution,
  2. extract it somewhere (e.g. /opt/yii in *nix or C:/web/yii in windows.)
  3. Now put that directory in your path ($PATH in *nix, or %PATH% in windows),
  4. go to a shell / command prompt, change the directory to your webserver's document root and do a yiic webapp <app folder name>

After answering a couple config question, you should have an look at the index.php created there, you should have something like:

<?php

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

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

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

and that's about it :p

like image 147
ZaQ Avatar answered Oct 01 '26 07:10

ZaQ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!