3. Membuat Aplikasi Web Untuk mebuat aplikasi dengan Framework Yii maka ikuti langkahlangkah berikut : Misalkan yii sebagai folder di mana Yii diinstalasi, dan myweb adalah document root dari Web Server kita. Jalankan yiic pada baris perintah seperti berikut: jika menggunakan LINUX masuk ke folder cd /var/www/html/yii/framework cd /var/www/html/yii/framework [root@localhost framework]# ./yiic webapp /var/www/html/myweb Create a Web application under '/var/www/html/myweb'? (yes|no) [no]:y mkdir /var/www/html/myweb generate index.php generate index-test.php mkdir /var/www/html/myweb/themes mkdir /var/www/html/myweb/themes/classic mkdir /var/www/html/myweb/themes/classic/views mkdir /var/www/html/myweb/themes/classic/views/layouts generate themes/classic/views/.htaccess mkdir /var/www/html/myweb/themes/classic/views/system mkdir /var/www/html/myweb/themes/classic/views/site mkdir /var/www/html/myweb/assets mkdir /var/www/html/myweb/protected mkdir /var/www/html/myweb/protected/tests mkdir /var/www/html/myweb/protected/tests/unit
mkdir /var/www/html/myweb/protected/tests/functional generate protected/tests/functional/SiteTest.php generate protected/tests/phpunit.xml generate protected/tests/WebTestCase.php mkdir /var/www/html/myweb/protected/tests/fixtures mkdir /var/www/html/myweb/protected/tests/report generate protected/tests/bootstrap.php generate protected/yiic generate protected/yiic.php mkdir /var/www/html/myweb/protected/extensions mkdir /var/www/html/myweb/protected/components generate protected/components/UserIdentity.php generate protected/components/Controller.php mkdir /var/www/html/myweb/protected/commands mkdir /var/www/html/myweb/protected/commands/shell mkdir /var/www/html/myweb/protected/migrations generate protected/.htaccess mkdir /var/www/html/myweb/protected/data generate protected/data/schema.sqlite.sql generate protected/data/testdrive.db generate protected/data/schema.mysql.sql mkdir /var/www/html/myweb/protected/controllers generate protected/controllers/SiteController.php mkdir /var/www/html/myweb/protected/messages mkdir /var/www/html/myweb/protected/views mkdir /var/www/html/myweb/protected/views/layouts generate protected/views/layouts/column2.php generate protected/views/layouts/main.php generate protected/views/layouts/column1.php mkdir /var/www/html/myweb/protected/views/site generate protected/views/site/index.php generate protected/views/site/login.php mkdir /var/www/html/myweb/protected/views/site/pages generate protected/views/site/pages/about.php generate protected/views/site/contact.php generate protected/views/site/error.php
mkdir mkdir generate generate generate mkdir generate generate generate mkdir generate generate generate generate generate generate mkdir
/var/www/html/myweb/protected/runtime /var/www/html/myweb/protected/models protected/models/ContactForm.php protected/models/LoginForm.php protected/yiic.bat /var/www/html/myweb/protected/config protected/config/main.php protected/config/console.php protected/config/test.php /var/www/html/myweb/css css/print.css css/form.css css/ie.css css/main.css css/screen.css css/bg.gif /var/www/html/myweb/images
Your application has been created successfully under /var/www/html/myweb.
Penjelasan : [root@localhost framework]# ./yiic webapp /var/www/html/myweb yiic : program generator untuk membuat aplikasi web dengan Yii webapp : Parameter web aplikasi var/www/html/myweb : tampat untuk meletakan aplikasi di folder
mencoba menjalankan http://localhost/myweb/
Gambar Kesalahan Pembacaan Sistem Tanggal Untuk mengatasi bila terjadi kesalahan tanggal, yang harus dilakukan adalah mengubah file index.php yang terdapat pada folder /var/www/html/myweb/index.php, tambahkan kode berikut : date_default_timezone_set('Asia/Jakarta'); lebih lengkapnya seperti pada kode berikut : file index.php
n.php'; // remove the following lines when in production mode defined('YII_DEBUG') or define('YII_DEBUG',true); // specify how many levels of call stack should be shown in each log message defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); require_once($yii); Yii::createWebApplication($config)->run();