Langkah yang harus kita lakukan setelah proses instalasi adalah cek DB connection/ setting db.
Defaulth DB saat instalasi berada pada file common/config/main-local.php
seperti gambar dibawah ini :
Setelah itu buka file main-local.php , kurang lebih isinya seperti dibawah ini :
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=belajaryii2',
'username' => 'root',
'password' => 'password',
'charset' => 'utf8',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
],
];
KETERANGAN :
Untuk tulisan berwarna merah diatas adalah file db,user&password. Bisa anda ganti sesuai local server anda atapun file hosting anda.
Oke lanjut.....
Selanjutnya anda harus ceck requirement anda:
CECK REQUIREMENT
Selanjutnya anda harus ceck requirement anda:
CECK REQUIREMENT
Setelah anda melakukan proses instalasi,langkah yang harus ditempuh adalah ceck requirement file anda, apakah sudah memenuhi atau belum. caranya :
php.exe ../htdocs/advanced/requirements.php
Untuk error dan warning di tinggalin aja, kalau masih error googling aje ye..hehehe
KOMPONEN YANG ADA PADA YII 2.0.2 / STRUKTUR :
The root directory contains the following subdirectories:
backend - backend web application.
common - files common to all applications.
console - console application.
environments - environment configs.
frontend - frontend web application.
Root directory contains a set of files.
.gitignore contains a list of directories ignored by git version system. If you need something never get to your source code repository, add it there.
composer.json - Composer config described in detail below.
init - initialization script described in “Composer config described in detail below”.
init.bat - same for Windows.
LICENSE.md - license info. Put your project license there. Especially when opensourcing.
README.md - basic info about installing template. Consider replacing it with information about your project and its installation.
requirements.php - Yii requirements checker.
yii - console application bootstrap.
yii.bat - same for Windows.
Intinya, ada 3 aplikasi yaitu frontend, backend dan console.
Frontend adalah aplikasi web yang akan ditampilkan untuk end user.
Backend adalah aplikasi web yang berfungsi untuk administrator dalam mengelola aplikasi frontend.
Console adalah aplikasi yang digunakan untuk cron jobs and low-level server management. dan juga digunakan selama deployment aplikasi dan menghandle migrations dan assets.
Ada juga folder common yang berisi file2 yang digunakan oleh lebih dari satu aplikasi, sebagai contoh global configuration seperti pengaturan koneksi database, atau general model seperti model user.
Predefined path aliases
- @yii – framework directory.
- @app – base path of currently running application.
- @common – common directory.
- @frontend – frontend web application directory.
- @backend – backend web application directory.
- @console – console directory.
- @runtime – runtime directory of currently running web application.
- @vendor – Composer vendor directory.
- @web – base URL of currently running web application.
- @webroot – web root directory of currently running web application.
SETTING DATABASE & MIGRATE
- Seperti yang saya jelaskan diatas, pada directory common/config/main-local.php disana ada setting defaulth. disana saya contohkan nama databasenya : belajaryii2 . langkah yang harus anda lakukan adalah buat database dengan nama : belajaryii2
- Setelah anda buat databasenya, langkah selanjutnya adalah migrate database anda. fungsi migrate adalah mengisi otomatis file yang diperlukan pada database anda.
- Pertama masuk ke cd c:\xampp\php Setelah itu ketikkan dibawah ini :
php.exe ../htdocs/advanced/yii migrate
Jika berhasil akan muncul pemberitahuan seperti dibawah ini:
Asik....tabel akan muncul pada database yang kita buat tadi yaitu belejaryii2....
Setelah kita membuat database dan migratenya. langkah selanjutnya adalah cek url kita apakah berhasil atau belum dengan cara :
akses : http://localhost/advanced/frontend/web/
pilih SigUp
Kemudian pilih login setelah anda daftar :
Jika anda berhasil,maka akan muncul seperti ini :
Huh....capek juga ya.....Keep smiling.....Bila ada keluhan di komentar aje ye... Yes It Is
Sampai ketemu di artikel selanjutnya.......
0 Komentar untuk "Langkah kedua setelah Instalasi YII fame work 2.0.3"