SMS · VERSION 0.1 · HOSTING PILOT
Solar Management System
Two portals, one database: Power Division and Regional Operations. HTML, CSS, JavaScript, PHP and MySQL/MariaDB. No Node.js, Composer or Java installation is needed on your hosting account.
1. Hosting requirements
- PHP 8.1 or newer, with PDO MySQL, mbstring, GD, fileinfo and sessions. EXIF is recommended for camera image rotation.
- MySQL 8.0+ or MariaDB 10.6+. Create an empty database with utf8mb4 encoding.
- Apache or LiteSpeed with .htaccess access rules enabled. Nginx requires equivalent server configuration; see the sample below.
- HTTPS for the real site. Camera access depends on the phone/browser and permissions.
- Recommended PHP settings: memory_limit 256M, upload_max_filesize 16M, post_max_size 20M, max_execution_time 120.
- A writable private storage directory, and a hosting cron job for reminders and email.
2. Upload and configure — cPanel
-
Extract the ZIP on your computer. Upload the
solardirectory topublic_html. The final path should bepublic_html/solar/power/index.php, notpublic_html/solar/solar/power/index.php. Preserve the included .htaccess files; enable “Show Hidden Files” in File Manager. -
Open cPanel → MySQL Databases. Create
engrgolk_solar(or the database name your account permits), create a dedicated database user, and grant that user privileges on this database only. -
Open phpMyAdmin, select that empty database, and import
solar/database/schema.sql. Import once. Do not re-import over operational data. -
Copy
config.example.phptoconfig.php. Fill in db_host, db_port, db_name, db_user and db_pass. Set base_url tohttps://engrgo.lk/solaror your actual URL, without a trailing slash. - Replace setup_key with your own random string of at least 32 characters. Do not leave the sample value.
-
Prefer a private directory outside public_html, such as
/home/YOUR_CPANEL_USER/sms_storage. Set storage_path to this exact absolute path, and make it writable by PHP. Create anuploadssubdirectory. Use 0750 or the least permissions supported by your host; do not use 0777. The defaultsolar/storageis protected by .htaccess on Apache/LiteSpeed. -
Open
https://engrgo.lk/solar/setup.php. Enter the setup key, your name, email, username, and a password of at least 12 characters. This creates the first Administrator. There is no default login. -
Delete
setup.phpfrom hosting after success. The database also prevents repeated installation. - Open
https://engrgo.lk/solar/power/and sign in.
3. First-time administration
- Open Administration → add main regions, then their subregions.
- Add sites with ID, name, subregion, Mobitel/OOP ownership and actual solar status. Set the initial maintenance due date for installed/live sites that have no checklist yet.
-
Regional officers register at
/solar/rgo/. Power officers register at/solar/power/. Registration does not grant access immediately. - In Administration, verify the applicant, set their role and subregion, then enable Approved / active. An applicant's chosen portal is only a requested role.
- Regional users can access their assigned subregion. In this pilot each Regional account has one subregion; multi-subregion engineer assignments are a future enhancement.
- Administrators can open either portal. Power users use the Power portal; Regional users use the Regional portal.
4. Using the workflows
| Feature | How to test |
|---|---|
| Installation request | Regional → New Solar Requirement → choose a site, select close and far photographs, draw the layout, then submit. Power can create a proposal from Pending Installation. Only one non-rejected installation request per site is allowed. |
| Layout drawing | Add symbols, drag, pinch or use Size to resize, rotate, and confirm each placement. HCT is a straight line drawn by dragging. Rotate north in 45° increments. Confirm the entire drawing before saving. Power may add/revise a layout before approval; earlier confirmed data is retained in layout_revisions. Drawings are schematic, not to scale. |
| Installation review | Open record → Review → Approved → Planned → Installed → Live. Approval requires a confirmed layout and both location images. Approved, installed and live are separate states. |
| Faults | Submit a site, notes, theft indication and one image per applicable equipment category. Power reviews and assigns to a named Power, Regional or Vendor contact. |
| Maintenance | Complete all eight answers. Yes opens image upload for damage/cleaning findings. Communication Not OK requires a comment. Cleaning Yes creates one linked open cleaning request. Power can create a separate task from each maintenance finding and assign each independently. |
| Cleaning and tasks | Submitted → Review → Assigned → In progress → Completed → Closed. Completed means work is reported done; Closed means Power verified it. Power may return a completed job to In progress. Blocked requires a reason. Rejected requests may return to review. |
| Vendor work | No vendor login is included. Authorized Power officers record vendor completion and verification. Assigned RGO tasks can be updated by officers in that site's subregion. |
| Stock and planning | Add equipment types, receive stock with a reference, define a capacity package with a bill of materials, then reserve for an approved site. Reservations immediately reduce available stock. Cancelling returns the quantities once; installing consumes the reservation. Marking a deployment Installed updates the site register; update its installation request milestone separately. |
| IP plan | Enter site, IPv4 address, contiguous subnet mask, same-subnet gateway and port 1–65535. Export selected rows or all rows as CSV. |
| Reports | Open a record → Print / Save PDF → select Save as PDF in the browser. Wait for images to load. Summary Reports allows selected columns, type and text filters, CSV export and browser PDF. CSV opens in Excel; it is not a native .xlsx workbook. |
| Editing / deleting | Submitting officers may edit their unreviewed records. Power may edit unreviewed records. Reviewed data is locked; Power adds status comments. Deletion is a soft delete with an audit entry. Image replacements retain old files on disk but only the current image is displayed. |
5. Email and scheduled reminders
This package uses your hosting provider's configured PHP
mail() transport. It has no embedded SMTP credentials. Ask
your host to configure authenticated mail delivery for your domain, then
set mail_from and mail_enabled => true in
config.php. Verify real inbox delivery; mail() accepting a message is
not proof of inbox delivery.
Create a cPanel cron job every five minutes. Replace the PHP executable and account paths with your host's actual values:
*/5 * * * * /usr/local/bin/php /home/YOUR_CPANEL_USER/public_html/solar/bin/cron.php >/dev/null 2>&1
- Submission/status notifications go to active Power/Admin users and Regional users assigned to the site's subregion.
- Maintenance is due two calendar months after the last checklist, clamped to the last day of the destination month. Sites without a checklist use the initial due date.
- Fourteen days after the due date, a pending-site table is queued once per day for each relevant officer.
- Tasks assigned for more than fourteen days generate a daily reminder to their assigned contact.
- Email failures are retried on later runs, up to ten attempts. Review the queue and hosting mail logs if delivery fails; this pilot has no retry-management screen.
- Password reset links expire after one hour and are single-use. Password reset also invalidates previous sessions. Reset delivery depends on the cron job and configured mail.
- Emails contain HTML summary tables. They do not attach PDF documents or photographs in this release. Users open SMS for protected evidence and printable reports.
6. Your hosting test checklist
- Create a test site in each of two subregions and one Regional user per subregion. Confirm neither user can access the other's records, even by changing a report/image URL.
- On Android and iPhone, test Camera and Gallery separately. Confirm permission prompts, portrait image orientation, image readability and upload error messages. HEIC is not accepted by the backend; use JPEG/PNG/WebP or the camera's compatible format setting.
- Submit an installation with both photographs. Review it in Power, check the layout, approve, and progress through installation to Live.
- Submit maintenance with cleaning Yes and communication Not OK. Check the generated cleaning request and a separately created communication task.
- Assign a task to RGO, update it as the Regional officer, then verify and close it as Power.
- Receive 10 panels, define a package requiring 8, reserve once, and verify available stock becomes 2. Release it and verify stock returns to 10.
- Print a report with photographs and check page layout. Open an exported CSV in Excel.
- Check actual password-reset and submission email delivery. Test cron reminders with a test site's old initial due date.
- Disconnect the network while entering a form. Reconnect and retry. If a photograph upload fails after saving, the record stays saved and the form lets you retry the pending images.
- Test a narrow phone, tablet and desktop. Use Send feedback to report confusing steps. Save screenshots of issues and provide the page, browser/device and exact error text for the next update.
7. Release boundaries and next development
- Full offline drafts, background synchronization, automatic PDF generation/email attachments, native Excel workbooks, advanced cross-table report joins and bulk site CSV import remain future work.
- Layouts are stored as structured JSON and rendered in the application/report. Standalone server-generated layout image filenames, a revision-browsing interface, and physical shadow calculations remain future work. North/tree shadows are schematic only.
- Tasks and cleaning are represented by individual records with a linked source maintenance ID. Detailed task evidence on completion and separate vendor accounts are not yet included.
- Access is per role and a single Regional subregion. Staff directory/email-based division lookup, multiple regional assignments and configurable recipient groups remain future work.
- Live data loads on page navigation; this pilot does not use WebSockets or auto-refresh. The request register returns the latest 2,000 visible records. Pagination and large-dataset reporting should be added before exceeding that scale.
- Forms retain their current values while the page remains open after a connection error. They are not persisted across refresh/closing the browser.
- Some exceptional database/server errors show a generic safe message. Full details go to the PHP error log, never to ordinary users.
- No real phone/browser matrix or hosting email delivery has been verified in the development environment. Complete the above checklist before using it for operational records.
8. Maintenance, updates and backups
Back up the database and private storage/uploads together. Keep config.php private. Do not replace config.php or delete storage when uploading updates. Future releases should use incremental SQL migrations; never re-import schema.sql over live data. Check host/PHP logs for errors. Set display_errors=Off on hosting. Store backup archives outside public_html.
9. Nginx hosting note
Nginx ignores .htaccess. Ask the administrator to deny these paths before enabling the application, and keep storage outside the document root:
location ~ ^/solar/(app|database|storage|bin)/ { deny all; }
location ~ ^/solar/(config[^/]*\.php|README[^/]*|TEST[^/]*)$ { deny all; }
Your existing PHP-FPM configuration still needs to handle public PHP endpoints. Remove setup.php after installation. Verify protected paths return 403/404 rather than source, configuration or uploaded data.
10. File map
| Path | Purpose |
|---|---|
| power/ and rgo/ | Separate portal entry points |
| api.php, app/ | Shared PHP business rules and authentication |
| assets/ | Local CSS and JavaScript, including layout editor; no CDN dependency |
| database/schema.sql | First-install database schema |
| setup.php | One-time administrator creation |
| file.php / report.php | Authorized images and printable report |
| bin/cron.php | CLI email queue and maintenance/task reminders |
| config.example.php | Copy to config.php and set your hosting details |
| storage/ | Default protected uploads and cron lock |