# How to Host Laravel on cPanel

Deploying Laravel to cPanel requires a specific structure to keep your site secure.

## Prerequisites
1.  **PHP Version**: Ensure your cPanel supports **PHP 8.2 or 8.3**. (Check "Select PHP Version" in cPanel).
2.  **Database**: Create a MySQL database and user in cPanel (if you plan to use one).

## Step 1: Prepare Your Project Locally
Before uploading, you need to prepare the files.

1.  **Clean Up**: Delete the `node_modules` folder if it exists (you don't need it on the server).
2.  **Zip It**: Compress the entire `uraio` folder into a zip file named `uraio.zip`.

## Step 2: Upload to cPanel
1.  Log in to **cPanel File Manager**.
2.  Go to the **root directory** (usually `/home/yourusername/`). **Do NOT** go inside `public_html` yet.
3.  **Upload** `uraio.zip` here.
4.  **Extract** it. You should now have a folder `/home/yourusername/uraio`.

## Step 3: Publish the Public Files
The contents of the `public` folder need to go into `public_html` (the folder the world sees).

1.  Go to `/home/yourusername/uraio/public`.
2.  **Select All** files.
3.  **Move** them to `/home/yourusername/public_html`.
    *   *Note: If you are hosting on a subdomain, move them to your subdomain folder instead.*

## Step 4: Connect the Dots
Now we need to tell the `index.php` file where the rest of the Laravel application is hiding.

1.  Go to `/home/yourusername/public_html`.
2.  Edit `index.php`.
3.  Find these two lines (around lines 34 and 47):

```php
require __DIR__.'/../vendor/autoload.php';
...
$app = require_once __DIR__.'/../bootstrap/app.php';
```

4.  **Change them** to point to your `uraio` folder. It should look like this:

```php
require __DIR__.'/../uraio/vendor/autoload.php';
...
$app = require_once __DIR__.'/../uraio/bootstrap/app.php';
```

## Step 5: Configure Environment
1.  Go to `/home/yourusername/uraio`.
2.  Edit the `.env` file (if you don't see it, click "Settings" in File Manager and enable "Show Hidden Files").
3.  Update these settings:
    *   `APP_NAME=URAIO`
    *   `APP_ENV=production`
    *   `APP_DEBUG=false` (Important for security!)
    *   `APP_URL=https://your-domain.com`
    *   **Database** (if used):
        ```
        DB_DATABASE=your_cpanel_db_name
        DB_USERNAME=your_cpanel_db_user
        DB_PASSWORD=your_cpanel_db_password
        ```

## Step 6: Set Permissions (If needed)
If you get a "Permission Denied" error:
1.  Go to `/home/yourusername/uraio`.
2.  Right-click `storage` -> **Change Permissions**.
3.  Set it to **775** (User: RWE, Group: RWE, World: RE).
4.  Do the same for `bootstrap/cache`.

## Done!
Visit your domain. Your Laravel app should be live.
