# Panduan Pemasangan - CV Personal Website

## Langkah-langkah Pemasangan

### 1. Setup Database

```bash
# Masuk ke MySQL
mysql -u root -p

# Atau gunakan phpMyAdmin di http://localhost/phpmyadmin
```

Import fail SQL:
1. Buka phpMyAdmin
2. Klik "Import"
3. Pilih `database/schema.sql`
4. Klik "Go"
5. (Pilihan) Import `database/sample_data.sql` untuk data contoh

### 2. Konfigurasi

Edit `includes/config.php`:
```php
define('DB_HOST', 'localhost');
define('DB_NAME', 'cv_db');
define('DB_USER', 'root');
define('DB_PASS', ''); // Masukkan password MySQL anda
define('SITE_URL', 'http://localhost/cv'); // Sesuaikan jika perlu
```

### 3. Install Composer Dependencies

```bash
cd /Applications/XAMPP/xamppfiles/htdocs/cv
composer install
```

Atau jika tiada Composer, download dompdf manual:
- Download: https://github.com/dompdf/dompdf/releases
- Extract ke folder `vendor/dompdf/dompdf/`

### 4. Set Permission

```bash
chmod 755 assets/images/uploads
```

### 5. Akses

- **CV**: http://localhost/cv/
- **Admin**: http://localhost/cv/admin/login.php
  - Username: `admin`
  - Password: `admin123`

## Troubleshooting

### Error: Database connection failed
- Semak MySQL service berjalan
- Semak maklumat database dalam `config.php`
- Pastikan database `cv_db` telah dibuat

### Error: PDF tidak berfungsi
- Pastikan dompdf library telah diinstall
- Semak folder `vendor/` wujud
- Enable PHP extension: `gd`, `mbstring`

### Error: Gambar tidak boleh upload
- Semak folder `assets/images/uploads/` wujud
- Set permission: `chmod 755 assets/images/uploads`
- Semak `MAX_FILE_SIZE` dalam `config.php` dan `php.ini`

### Error: Session tidak berfungsi
- Semak folder session writable
- Semak `session.save_path` dalam `php.ini`

## Default Password

⚠️ **PENTING**: Tukar password admin selepas login pertama!

Untuk tukar password, jalankan SQL:
```sql
UPDATE users SET password = '$2y$10$...' WHERE username = 'admin';
```

Atau gunakan PHP:
```php
$newPassword = password_hash('newpassword', PASSWORD_DEFAULT);
// Update dalam database
```

