# Raj Group CodeIgniter 4 deployment on cPanel

## Framework installation (mandatory)
1. PHP 8.2+ with `intl`, `mbstring`, `mysqli`, Composer 2; HTTPS enabled.
2. On a workstation or SSH-enabled host run `composer create-project codeigniter4/appstarter:^4.7 rajgroup-live` then `cd rajgroup-live && composer require codeigniter4/framework:4.7.5`.
3. OVERLAY this ZIP's `app/Controllers`, `app/Models`, `app/Views`, `app/Config/Routes.php`, and `public/assets/`, `public/.htaccess`, robots and sitemap onto that official appstarter. Do not delete standard CI4 config files; retain its bootstrap.
4. Copy `env.example` to your appstarter root as `.env`, insert actual MySQL credentials, set a correct `app.baseURL` and production environment. Never commit credentials.
5. In cPanel MySQL Databases create DB and user. Import `database/rajgroup_mysql.sql`, adjusting database name to cPanel prefix and DB selection. OR use the included migration for enquiries (not both for same table).
6. Create initial admin SQL hash locally using `php database/create_admin.php admin@example.com 'long-random-password'`; paste generated SQL into phpMyAdmin after importing schema. Do not publish passwords or the SQL output.
7. Enable CSRF in your appstarter's `app/Config/Filters.php` for all POST forms, set cookie secure flags, configure session storage, server-side spam/rate protection, and mail delivery as needed.
8. Set the domain **document root** to `.../rajgroup-live/public`. Do NOT place full project folders in publicly web-accessible directory or serve it through `/public` in URL. CI4 `public/index.php` routes to the framework.
9. Ensure `writable/` belongs to your PHP user and isn't world writable. Test `/`, `/brands`, `/contact`, POST `/enquiry/send`, `/admin/login`, login/logout, and `/admin/articles` on staging.
10. Run security review, verify product claims/assets, and configure backups, monitoring, robots/canonicals before going live.

Do not overwrite existing live site without backup. The old CI3 version and CI4 are not drop-in compatible.
