🎯 DC2PHP—an ultra-fast, lightweight native Win32 execution bridge written entirely in pure C (C89/C99). If you are tired of bulky runtime dependencies, resource leaks, and bloated web server stacks just to run background PHP script pipelines, your search ends here.
When building automated system tools 🛠️, telemetry aggregators 📊, or localized background workers 🤖, developers often need a clean way to execute and chain scripts without complex web server stacks like Apache or IIS. Running raw command-line PHP scripts manually or through poorly managed shell scripts often leads to:
- 🧟 Unmanaged background processes lingering in memory.
- 🕳️ Lost standard output (
stdout) streams and hard-to-debug failures. - 📂 Fragmented working directory contexts when called from external editors or desktop utilities.
- 📈 Lack of persistent metrics and structured task tracking.
DC2PHP eliminates these headaches.
🛡️ It acts as a hardened binary supervisor, wrapping your PHP execution workflows inside a secure Win32 process model while handling pipe-based output redirection in real-time, parsing structured JSON configurations, and tracking usage hits via a persistent telemetry file (metrics.json).
- You can downlaod and install PHP FREE HERE!
- 🪶 Zero-Dependency Footprint: Written in pure native C using standard Win32 system APIs (
CreateProcessA, anonymous pipes) without heavy frameworks. - 📌 Autonomous Directory Rooting: Automatically locks its working context to the binary's actual location via
GetModuleFileNameAandSetCurrentDirectoryA, ensuring absolute path stability even when invoked from Notepad, desktop shortcuts, or external tools. - 🧩 Structured JSON Pipeline Orchestration: Easily group script tasks together using JSON configurations while safely bypassing embedded metadata (like project names or version numbers).
- ⚙️ Native Query String Tokenization: Automatically parses query parameters attached to script paths (e.g.,
test.php?step=boot&mode=clean) and tokenizes them into CLI-friendly arguments that populate$_GETand$argvnatively. - 🛡️ Integrated Memory Protection: Bundled with the custom
DX-TRACKallocation engine to ensure zero-leak handle and memory management during intense execution cycles.
- Win32/x64 PHP8 Command line connection for exec
- Connects your executables to your PHP installation directly without a need for apache
If you want to dive straight into execution without reading the full technical breakdown, here are the most common commands:
Use this comprehensive test suite to verify your upgraded dc2php.exe wrapper—covering help output formatting, raw inline PHP execution (-eval), JSON batch task parsing, and CLI passthrough.
Goal: Verify complete stream flushing.
Run this from your console or test wrapper to confirm the usage manual prints completely without truncation:
dc2php.exe -hGoal: Verify the raw PHP execution engine.
Run an inline command to confirm that string output streams back cleanly into your telemetry buffer:
dc2php.exe -eval "echo 'DC2PHP Raw Engine Active: ' . phpversion();"Goal: Verify recursive path parsing and argument tokenization.
- Create a test configuration file named
test_pipeline.jsonin your workspace:
{
"root": "./",
"pipeline": [
"script.php?step=boot&mode=clean"
]
}- Execute the configuration file via your wrapper:
dc2php.exe -json test_pipeline.jsonGoal: Verify arbitrary flag forwarding.
Confirm that flags pass straight through to the underlying php.exe runtime:
dc2php.exe -pass -vBecause dc2php acts as an orchestration wrapper rather than an interpreter, it relies on an underlying PHP runtime to execute script targets.
PHP is a widely-used open-source scripting language. In the dc2php ecosystem, PHP serves as the high-speed background worker engine. When dc2php parses a script or JSON pipeline step, it launches php.exe in a hidden background process (CREATE_NO_WINDOW), creates anonymous Win32 pipes to capture standard output (stdout), and streams the results back to your console in real time.
- 📦 Download the latest PHP Thread Safe (TS) x64 Zip Package for Windows from the official PHP downloads repository.
- 📁 Create a folder named
phpinside your main workspace directory (e.g.,C:\MercwarAI\php). - 📂 Extract the contents of the ZIP file directly into
C:\MercwarAI\php. - ✅ Ensure that
php.exe,php8ts.dll, and theinclude/andlib/subfolders are present in that directory so the wrapper and compiler can interact with them.
To get started with the source code and build files, clone the repository and connect your command line environment to the workspace root.
Open your terminal or Git Bash shell and clone the project into your local development directory:
git clone https://github.com/mercwar/dc2php.git C:\MercwarAI
cd /d C:\MercwarAI
Open a standard Windows Command Prompt (cmd.exe) and anchor your terminal session to the project root directory:
cd /d C:\MercwarAI
Verify that your directory contains main.c, build.bat, resource.rc, and your php\ runtime folder before proceeding to compilation.
📦 Once compiled, dc2php.exe can be invoked directly from the command line. It initializes the DX-TRACK memory allocation registers, checks input flags, sets up pipe redirection, and handles process lifecycles cleanly.
To build the binary using your automated MSVC batch script:
build.bat
The script provisions the MSVC x64 environment (vcvars64.bat), compiles the Win32 resource metadata (resource.rc), and links dc2php.exe with zero resource leaks.
dc2php supports multiple routing switches depending on whether you are executing JSON pipelines, batch files, raw executables, or passing direct parameters.
dc2php.exe [command] [arguments...]
| Flag | Argument | Description |
|---|---|---|
-json |
<config.json> |
📜 Parses and executes a recursive script pipeline from a JSON configuration file. |
-bat |
<script.bat> [args...] |
⚙️ Executes a Windows batch script wrapper through the pipeline. |
-exe |
<script.exe> [args...] |
🚀 Executes a compiled executable file wrapper through the pipeline. |
-pass |
[php_flags...] |
🔀 Direct passthrough mode forwarding all subsequent parameters straight to php.exe. |
**-h, --help** |
None | ❓ Displays the built-in usage manual reference. |
The core strength of dc2php lies in its recursive JSON configuration engine. It allows you to group script targets, manage folder roots, and pass query string parameters.
When walking through complex JSON configurations, the parser looks for whitelisted task containers ("scripts", "pipeline", "tasks", "actions", "steps").
Any top-level or embedded metadata fields—such as "project", "name", "version", or "author"—are automatically bypassed and ignored. This means you can safely hardcode versioning and workspace descriptors directly into your JSON files without the parser crashing or treating them as file paths!
{
"root": ".",
"project": "Mercwar Automation Workspace",
"version": "1.1.0",
"scripts": [
"test.php?step=boot&mode=clean",
"test.php?step=verify&mode=deep",
"test.php?step=finalize&mode=sync"
]
}
- 🔗 Query String Parsing: The wrapper automatically splits
?query strings (e.g.,step=boot&mode=clean), tokenizes the parameters, and forwards them intophp.exeso scripts can read them natively via$_GETor CLI arguments.
- You can downlaod and install PHP FREE HERE!
- No extra runtimes built on windows 11 VC++ Redist
- Third-party libraries are native Windows and PHP
- Installing php and your done!. 🗑️
DC2PHP is built differently. Here is why this engine stands alone in a league of its own:
- 🚀 Unrivaled Speed & Microscopic Footprint: Written from the ground up in pure C (C89/C99), DC2PHP compiles down to an ultra-lean native binary that boots instantly, consumes virtually zero RAM, and executes pipelines with zero interpreter latency.
- ⚓ Bulletproof Autonomous Rooting: While other tools choke when executed from a different directory or launched out of an external text editor, DC2PHP binds itself to its physical home at startup. It doesn't guess paths—it locks them down.
- 🦅 Flawless Win32 Process Control: By leveraging direct Win32 system APIs like
CreateProcessAand anonymous pipe redirection, DC2PHP supervises backgroundphp.exeinstances like a hawk, capturing output streams in real time without dropping a single byte or leaving zombie processes behind. - 🧠 Smart Recursive JSON Parsing: Most parsers throw a tantrum if your configuration file contains extra descriptive keys. DC2PHP intelligently filters whitelisted task steps while gracefully ignoring metadata like project titles and version numbers, letting you document your configs right inside the JSON.
- 🛡️ Impenetrable Memory Discipline: Integrated directly with the custom
DX-TRACKallocation registry, DC2PHP tracks and flushes system handles with absolute precision, guaranteeing a completely leak-free operational lifecycle even under millions of continuous execution hits.
- 🔲 Core Binary:
dc2php.exe(Win64 Console Subsystem) - 💻 Language Standard: Pure C (C89/C99), Native Win32 API (
CreateProcessA, anonymous pipes, security attributes) - 🛠️ Build Toolchain: Microsoft Visual Studio MSVC (
cl.exe,rc.exe), MSYS2 UCRT64 compatibility - 🧠 Memory Management: Integrated with the custom
DX-TRACKallocation tracking system (Tracker.c/Tracker.h) - 📑 JSON Parsing: Embedded cJSON library for zero-dependency pipeline interpretation
- 🏷️ Resource Binding: Compiled with
resource.rcfor Windows version metadata and publisher attribution (Mercwar AI)
Every time dc2php.exe executes a background session, it updates a persistent metrics.json file in the working directory to track operational usage:
{
"application_hits": 47,
"session_hits": 47
}
The true power of dc2php goes beyond standalone CLI execution—it is explicitly architected to serve as the foundational execution core for larger automation systems, graphical control panels, and distributed background worker networks.
Because dc2php roots itself to its binary path using GetModuleFileNameA and SetCurrentDirectoryA at startup, it can be safely spawned from external graphical wrappers (such as the Cyborg telemetry console, Windows Task Scheduler, or desktop shortcut manifests) without failing to locate relative configuration files or JSON scripts.
By chaining query string arguments within JSON configurations, developers can construct robust multi-phase deployment and testing pipelines:
- 🟢 Initialization Phase: Pass explicit bootstrap parameters (
?step=boot&mode=clean) to clear caches, verify handles, and initialize log registers. - 🟡 Execution & Validation Phase: Route deep telemetry checks (
?step=verify&mode=deep) to ensure child processes are returning valid exit codes and streaming cleanstdoutbuffers. - 🔴 Commit & Flush Phase: Finalize transactions (
?step=finalize&mode=sync) to write out persistent metrics and safely teardown allocated memory handles viaDX-TRACK.
Advanced engineers can extend main.c to hook into custom IPC channels, pipe asynchronous binary payloads into WebSocket bridging subsystems (dc2ws2), or inject custom environment variables directly into the child process block during CreateProcessA calls.
This software and its documentation are provided under the operational governance of the Mercwar AI Ecosystem. Review the terms below governing copyright, warranty disclaimer, and liability limitation.
Copyright (C) 2026 Joseph M. Catalano (Mercwar AI). All rights reserved.
The software binary (dc2php.exe), source code modules (main.c, resource.rc), and documentation are proprietary works of authorship. Unauthorized duplication, modification, or distribution outside authorized developer environments is strictly prohibited.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Under no circumstances and under no legal theory, whether in tort, contract, or otherwise, shall the copyright holder or contributors be liable for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses arising out of or related to the execution, operation, or configuration of this pipeline wrapper.

