In this article, Will show you how we can run a PHP process in background in windows server.
Prerequisite PHP DOM Extension: https://www.php.net/manual/en/dom.setup.php
Or it can be found in PHP installation in ext folder "php_com_dotnet.dll
". Just enable in php.ini config file as extension=php_com_dotnet.dll
<?php
// ** Requires PHP php_com_dotnet extension //
$phpInterpreter="C:/Program Files (x86)/PHP/v7.0/php.exe"; // PHP execution path//
// Run command and destination for script which runs in background
$runCommand = "\"\"$phpInterpreter\" -q \"path-to-the-script\"\"";
$WshShell = new COM("WScript.Shell");
// 0 for aysn and in background no window //
$oExec = $WshShell->Run('cmd /C '.$runCommand, 0, false);
?>