# Shoeniverse — putting the site on cPanel

No SSH or Composer is needed. Everything is already installed and the catalogue (699 products, 775 photos) is ready to import.

You need two zip files and one database file:

| File | What it is |
|---|---|
| `shoeniverse-cpanel-app.zip` | The website and its libraries, with the settings file `.env` |
| `shoeniverse-cpanel-photos-part1.zip` and `-part2.zip` | All product photos (the `storage` folder), split in two for easier upload |
| `shoeniverse/database/cpanel/shoeniverse.sql` | The database: catalogue, homepage rails, settings, first admin login. It's inside the app zip |

Replace `CPANELUSER` below with your cPanel username.

---

## 1. Check PHP

cPanel › **MultiPHP Manager** (or **Select PHP Version**): set the domain to **PHP 8.3 or newer**.
Make sure these extensions are ticked: `pdo_mysql`, `mbstring`, `intl`, `gd`, `zip`, `fileinfo`, `openssl`, `curl`.

## 2. Create the database

1. cPanel › **MySQL® Databases** › create a database called `shoeniverse`. cPanel names it `CPANELUSER_shoeniverse`.
2. On the same page, create a user, for example `CPANELUSER_shoeniverse`, with a strong password.
3. Under **Add user to database**, pick both and tick **ALL PRIVILEGES**.
4. cPanel › **phpMyAdmin** › click the new database › **Import** › choose `shoeniverse.sql` › **Import**.
   Extract it from the app zip on your computer first; it's in `shoeniverse/database/cpanel/`.

## 3. Upload the files

1. cPanel › **File Manager**. Open your home folder (`/home/CPANELUSER`, the one that contains `public_html`).
2. **Upload** `shoeniverse-cpanel-app.zip`, then right-click it › **Extract**. You now have `/home/CPANELUSER/shoeniverse`.
3. Open `shoeniverse/public`, **Upload** both photo zips there and **Extract** each one. Both fill the same `storage` folder. You now have `shoeniverse/public/storage/products/…`.
4. Delete both zip files afterwards to save space.

> File Manager hides files starting with a dot. Click **Settings › Show Hidden Files** so you can see `.env` and `.htaccess`.

## 4. Fill in the settings file

Edit `shoeniverse/.env` (right-click › Edit) and set:

```
APP_URL=https://www.shoeniverse.co.ke
DB_DATABASE=CPANELUSER_shoeniverse
DB_USERNAME=CPANELUSER_shoeniverse
DB_PASSWORD=the password from step 2
```

Leave `APP_KEY` as it is; it's already generated. Add the M-Pesa keys later, once Safaricom issues them. Until then, orders still come in, and the customer is told you'll confirm payment on WhatsApp.

## 5. Point the domain at the site — choose ONE option

### Option A (recommended): change the document root

cPanel › **Domains** › `shoeniverse.co.ke` › **Manage** › set **Document Root** to

```
/home/CPANELUSER/shoeniverse/public
```

Save. That's it. (Some hosts don't let you change the main domain's root. If so, use Option B.)

### Option B: keep using public_html

1. Back up anything already in `public_html`, then empty it.
2. Open `shoeniverse/public`, select everything inside it (including `.htaccess` and the `storage` folder) › **Move** to `/home/CPANELUSER/public_html`.
3. Delete `public_html/index.php`.
4. Copy `shoeniverse/cpanel/index.php.for-public_html` into `public_html` and rename it to `index.php`.

## 6. Switch on HTTPS

cPanel › **SSL/TLS Status** › run **AutoSSL** for the domain. The site expects `https://`.

## 7. Open the site

- Shop: `https://www.shoeniverse.co.ke`
- Admin: `https://www.shoeniverse.co.ke/admin`. The login is in `FIRST-LOGIN.txt`. Change the password straight away (top-right avatar › **Profile**), then delete `FIRST-LOGIN.txt`.

---

## If something isn't right

| You see | Fix |
|---|---|
| **500 error** | Check the PHP version (8.3+) and the database details in `.env`. The real error is in `shoeniverse/storage/logs/` (newest file). |
| Home page works but every other page gives **404** | `.htaccess` is missing from the site folder. Turn on **Show Hidden Files** and make sure it was moved or extracted. |
| **No product photos** | The photos zip wasn't extracted into the right place. You should have `…/public/storage/products/12/xxxx-640.webp` (Option A) or `public_html/storage/products/…` (Option B). |
| “Permission denied” in the logs | Set the folders `shoeniverse/storage` and `shoeniverse/bootstrap/cache` to permission **755** (files 644). |
| Admin password forgotten | Set up email in `.env` (cPanel › Email Accounts gives the values) and use “Forgot password” on the login page. |

## Updating the site later

Code lives at github.com/nnyutho/shoeniverse. To update, replace the `app`, `resources`, `routes` and `config` folders with the new versions. Leave `.env`, `storage` and `public/storage` as they are, since they hold your settings and photos.

## M-Pesa

When Safaricom issues the Daraja keys, fill in the `MPESA_…` lines in `.env`. Safaricom must be able to reach:

```
https://www.shoeniverse.co.ke/mpesa/callback
```
