# cPanel deployment fix for BOTz Cloner ☕︎

If the domain shows an `Index of /` directory listing, the domain is pointing at the Laravel project root. The document root must point to the `public/` directory.

## What the current host is reporting

- LiteSpeed is serving a directory listing instead of Laravel.
- The current server reports PHP 7.1.33.
- This project targets Laravel 11 and requires PHP 8.2+.
- The project root contains `app/`, `config/`, `database/`, `tests/`, and the project ZIP; these must not be publicly browsable.

## Fix order

1. In cPanel, open **MultiPHP Manager** and select PHP **8.2 or newer** for the subdomain. Enable `openssl`, `mbstring`, `pdo_mysql`, `json`, and `zip`.
2. Open **Domains** and change the document root for `bot.icxbd.fsbd.pro` to the absolute project path ending in `/public`, for example:

   ```text
   /home/CPANEL_USER/botz-cloner/public
   ```

3. Remove the publicly accessible project-root files or move the project outside `public_html`. Do not leave `BOTz-Cloner-cpanel.zip`, `composer.json`, `app/`, `config/`, `database/`, or `tests/` under the web document root.
4. On a build machine or cPanel Terminal, from the project root run:

   ```bash
   composer install --no-dev --optimize-autoloader
   cp .env.example .env
   php artisan key:generate
   php artisan storage:link
   php artisan migrate --seed
   php artisan config:cache
   php artisan route:cache
   php artisan view:cache
   ```

5. Build the Vite/Tailwind assets locally and upload `public/build`:

   ```bash
   npm install
   npm run build
   ```

   Node.js is not required at runtime.

6. Configure `.env` with MySQL, Google OAuth, HTTPS, Telegram, and the server-only AI key:

   ```dotenv
   APP_ENV=production
   APP_DEBUG=false
   APP_URL=https://bot.icxbd.fsbd.pro
   SESSION_DRIVER=database
   SESSION_SECURE_COOKIE=true

   GOOGLE_CLIENT_ID=
   GOOGLE_CLIENT_SECRET=
   GOOGLE_REDIRECT_URI=https://bot.icxbd.fsbd.pro/auth/google/callback

   TELEGRAM_WEBHOOK_BASE_URL=https://bot.icxbd.fsbd.pro
   AI_CHAT_API_KEY=
   AI_CHAT_GEM_ID=6ef58742-1b56-4026-916b-47d3e4dfc75b
   ```

7. Set writable permissions for `storage/` and `bootstrap/cache/` only. Do not make the entire project writable.
8. If the host cannot change the document root, keep the Laravel project one directory above `public_html`, copy only the contents of `public/` into `public_html`, and update the two parent paths in `public_html/index.php` so they point to the real project root. Do not copy `app/`, `config/`, `.env`, or `vendor/` into a public directory.
9. Disable directory indexing in the hosting panel or confirm that the `public/.htaccess` file is present.
10. Remove any old publicly accessible ZIP files after deployment.

## Database-only import

If Artisan migrations cannot run, import `database/botz_cloner.sql` in phpMyAdmin and then run:

```bash
php artisan db:seed
```

The seed command creates the hashed bootstrap administrator and publishes the three default templates. It does not place the AI API key in the database.
