Tag Archive Yii 2

Byphunsanit

ติดตั้ง YII

ลง yii ไม่อยาก ไม่กี่นาทีก็ได้โครงของโปรเจคแล้ว

  1. โหลดตัว framework มาก่อนจาก yiiframework
  2. แตกไฟล์ใส่ htdocs folder ของผมอยู่ที่ D:\xampp\htdocs (ปกติคือ C:\xampp\htdocs)
  3. ถ้าแตกไฟล์เก็บไว้ใน folder D:\xampp\htdocs\yii1 เปิด command พิมพ์
    • d: กด enter
    • พิมพ์ cd D:\xampp\htdocs\yii1\framework กด enter
  4. สร้าง Skeleton Application ถ้าต้องการสร้าง project ชื่อ JumpFlower (คืออะไรหาได้ใน google) เก็บที่ D:\xampp\htdocs\yii1\JumpFlower พิมพ์
    1
    yiic webapp <b>D:\xampp\htdocs\yii1\JumpFlower

    แล้ว enter ตอบ yes รอจนขึ้นข้อความ “your application has been create successfully under …”

  5. เปิดไฟล์ D:\xampp\htdocs\yii1\JumpFlower\protected\config\database.php แก้ เอา comment ออก ใส่ชื่อ database username password ใม่ตามที่ใช้จริง
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <?php
     
    // This is the database connection configuration.
    return array(
        'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        'connectionString' => 'mysql:host=localhost;dbname=yii1',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
        'tablePrefix'=>'tbl_',
    );

เสร็จ!