# OC 4.1 OCMOD PHP Fix
A small service module for OpenCart **4.1.x** that restores OCMOD extensions functionality on certain PHP/OS builds.
---
## What it fixes
- **Priority loader in `system/engine/factory.php`**
Ensures controllers, models, and libraries from the OCMOD cache or `extension/ocmod` are loaded properly without duplicate class definitions.
- **Polyfill for `glob_brace()` in `admin/controller/marketplace/modification.php`**
Required on musl/Alpine systems where `GLOB_BRACE` is missing.
- **Management page in Admin** with buttons:
- **Fix permissions**
- **Apply fix**
- **Uninstall (restore backups)**
- **View logs**
---
## Compatibility
- OpenCart **4.1.x**
- PHP **8.1+**
- Works on both glibc- and musl-based systems (Alpine)
- Docker / Podman supported
---
## Disclaimer
This module modifies OpenCart core files **at your own risk**.
The author is not responsible for any consequences, data loss, or failures.
Always back up your project (files + DB) before applying.
---
## Installation
1. Go to **Extensions → Installer** and upload the `.ocmod.zip`.
2. Navigate to **Extensions → Extensions → Modules** and **Install** the module **OC 4.1 OCMOD PHP Fix**.
The module is enabled automatically (no status toggle required).
---
## Usage
In the admin panel, open **Extensions → Extensions → Modules → OC 4.1 OCMOD PHP Fix**.
- **Fix permissions** — attempts to automatically set correct permissions on:
- `/system/engine/factory.php`
- `/admin/controller/marketplace/modification.php`
- **Apply fix** — creates `*.ocfix.bak` backups and applies both patches (priority loader + polyfill).
- **Uninstall (restore backups)** — restores original files from backups.
- **View logs** — shows entries from `system/storage/logs/ocfix.log`.
After **Apply** or **Rollback**:
1. **Extensions → Modifications → Refresh**
2. **Developer → Clear all caches**
---
## File permissions
The module tries to fix permissions automatically, but in some environments (docker bind-mounts, CIFS/NFS) this may fail.
In such cases, adjust permissions manually on the host/container as a privileged user.
---
[**GitHub Repository**]([url]https://github.com/Sergeymikh/ocmodfix[/url])
Login and write down your comment.
Login my OpenCart Account