# PawStreet cPanel deployment

This package is ready for a cPanel server running PHP 8.2 or newer. The compiled frontend and production Composer dependencies are included; Node.js is not required on the server.

## 1. Create the domain and database

1. In **cPanel → MultiPHP Manager**, select PHP 8.2 or newer for the domain.
2. Enable the common Laravel extensions: `ctype`, `curl`, `dom`, `fileinfo`, `filter`, `hash`, `mbstring`, `openssl`, `pdo_mysql`, `session`, `tokenizer`, and `xml`.
3. In **MySQL Databases**, create a database and user, then grant the user **All Privileges**.
4. Upload and extract this package to a private application directory such as `/home/CPANEL_USER/pawstreet`.
5. Set the domain or subdomain document root to `/home/CPANEL_USER/pawstreet/public`.

Do not point the domain at the application root. Only the `public` directory should be web-accessible.

## 2. Configure PawStreet

Open cPanel Terminal and run:

```bash
cd /home/CPANEL_USER/pawstreet
cp .env.cpanel.example .env
```

Edit `.env` and set:

- `APP_URL` to the final HTTPS domain.
- `DB_DATABASE`, `DB_USERNAME`, and `DB_PASSWORD` to the cPanel MySQL values.
- Mail credentials if email delivery is required.
- Stripe, Interakt, or Zoho credentials only when those integrations are used.

Then run:

```bash
php artisan key:generate --force
php artisan migrate --force --seed
php artisan storage:link
php artisan optimize
```

The seed command installs the working PawStreet demonstration company and service catalogue. Initial company administrator login:

- Email: `admin@pawstreet.com`
- Password: `PawStreet!2026`

Create your permanent administrator account and remove or deactivate the demonstration accounts immediately after the first login.

## 3. Permissions

The following directories must be writable by PHP:

```bash
chmod -R 775 storage bootstrap/cache
```

If your host uses a different PHP user, use cPanel’s **Fix Permissions** feature or ask the hosting provider to make these two directories writable.

## 4. Cron jobs

Replace `CPANEL_USER` and, if necessary, the PHP binary path. Add these in **cPanel → Cron Jobs**.

Laravel scheduler, every minute:

```text
* * * * * cd /home/CPANEL_USER/pawstreet && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1
```

Database queue, every minute:

```text
* * * * * cd /home/CPANEL_USER/pawstreet && /usr/local/bin/php artisan queue:work --stop-when-empty --tries=3 --timeout=120 >> /dev/null 2>&1
```

## 5. Final checks

1. Open `https://your-domain.com/up` and confirm it returns `status: ok`.
2. Open the landing page and login page.
3. Log in and create a test customer, pet, and appointment.
4. Confirm `https://your-domain.com/storage/...` files are accessible after an upload.
5. Configure the Stripe webhook as `https://your-domain.com/api/webhooks/stripe` if online payments are enabled.

When configuration changes later, run `php artisan optimize` again.
