# GamesJi Apps — shared cPanel installation

This release is designed for `https://gamesji.com/app` on Apache or LiteSpeed shared cPanel hosting. It needs PHP 8.2 or newer, PDO MySQL, cURL (recommended), JSON, mbstring, MySQL 8+ or MariaDB 10.5+, HTTPS and cPanel Cron Jobs. It does not need Node.js, npm, Composer, Docker, Redis, shell access after setup or a background worker.

## 1. Upload and extract

1. Open cPanel File Manager.
2. Open the document root that serves `gamesji.com`, then open or create `app`.
3. Upload the ZIP and extract its contents directly inside that folder.
4. Confirm that the path is similar to:

   `/home/CPANEL_USER/public_html/gamesji.com/app/index.php`

5. Make sure hidden files were extracted, especially `.htaccess`.

## 2. Create the database

1. In **MySQL Databases**, create a database and a database user.
2. Add the user to the database with **ALL PRIVILEGES**.
3. Keep the complete cPanel-prefixed database name and username ready.

You normally do not need to import `database.sql` manually because the web installer does it. The SQL file is included as a recovery/manual-install option.

## 3. Run the installer

1. Open `https://gamesji.com/app/install/`.
2. The installer checks PHP, required extensions and writable folders.
3. Enter the final URL, MySQL credentials and a strong administrator password.
4. Click **Install website**.
5. Log in at `https://gamesji.com/app/admin/`.

The installer creates `config.php`, imports the schema, creates the administrator, seeds safe settings and adds the built-in discovery sources. After installation, the installer locks itself.

If `config.php` cannot be written, temporarily set only the `app` folder to permission `755` or `775`, run the installer, and set it back to the hosting provider’s recommended permission. Never use permission `777`.

## 4. Set the hourly cron

Open **Admin → Settings & Ads** and copy the exact cron command shown there. Add it in **cPanel → Cron Jobs** with this schedule:

`0 * * * *`

Typical command:

`curl -fsS 'https://gamesji.com/app/cron.php?token=YOUR_GENERATED_TOKEN' >/dev/null 2>&1`

If cURL is unavailable in cron, use the CLI command:

`/usr/local/bin/php -q /home/CPANEL_USER/public_html/gamesji.com/app/cron.php --token=YOUR_GENERATED_TOKEN >/dev/null 2>&1`

Replace the PHP binary and home path with the values shown by your cPanel host. Never publish or share the cron token.

The cron is intentionally lightweight for shared hosting. Each run:

- checks a small number of due discovery sources;
- extracts Google Play package IDs;
- validates queued detail pages;
- expands through related-game links at a controlled rate;
- creates or updates separate game pages;
- refreshes stale records;
- retries temporary failures with exponential delay;
- removes old operational logs and completed queue rows.

## 5. First automation run

Open **Admin → Dashboard** and click **Run automation now** once. Review:

- **Admin → Games**
- **Admin → Sources**
- **Admin → Activity**
- **Admin → Health**

The first pages appear gradually. This is deliberate: a shared-hosting account and the source website must not be flooded with requests. Cron continues expanding the discovery graph automatically.

## 6. Google Search Console

1. Open **Admin → Settings & Ads**.
2. Paste the Google site-verification content value and save.
3. In Search Console, submit:

   `https://gamesji.com/app/sitemap.xml`

The sitemap is an index. It automatically splits game URLs into 5,000-URL files and includes categories, legal pages and image references. Only published pages are included.

## 7. Google AdSense

After AdSense approves the site:

1. Open **Admin → Settings & Ads**.
2. Enter the publisher client ID, such as `ca-pub-...`.
3. Enter the three numeric slot IDs.
4. Enable ads and save.

Ads are rendered only when both the global switch and the required client/slot values are present. This prevents blank or fake advertising blocks. AdSense approval, search indexing and rankings are decisions made by Google and cannot be guaranteed by software.

## 8. Final launch checklist

- HTTPS opens without a certificate warning.
- `/app/admin/` login works.
- Admin Health shows database, storage and PHP checks passing.
- Hourly cron has completed successfully.
- At least one validated game page opens.
- “View on Google Play” opens the official listing.
- “Play Free Game” opens `https://gamesji.com/`.
- `robots.txt`, `sitemap.xml`, `feed.xml` and `manifest.webmanifest` open.
- Privacy, terms, disclaimer, about and contact pages open.
- AdSense is enabled only after approval and real slot IDs are entered.
- `config.php`, `database.sql`, `storage` and app source folders cannot be opened publicly.

## Troubleshooting

### Database connection error

Use the full database name and username exactly as cPanel created them, including the account prefix. Confirm that the user has ALL PRIVILEGES on that database.

### Pretty URLs return 404

Confirm `.htaccess` exists in the `app` folder. In cPanel MultiPHP Manager, choose PHP 8.2 or newer. Ask the host to allow Apache/LiteSpeed rewrite rules.

### Cron shows 403

Copy the current token and complete command from **Admin → Settings & Ads**. Do not add spaces inside the URL.

### Cron runs but imports stay empty

Open **Admin → Sources** and review the exact source error. A source may change its markup, rate-limit requests or disallow automated access. The system pauses repeatedly failing sources instead of hammering them. Package IDs or legitimate feed-derived listing URLs can also be added through **Admin → Import**.

### HTTP 500

Open **Admin → Health** if possible and check cPanel’s `error_log`. Application exceptions are written to `storage/logs`; that directory is blocked from public access.
