# Prepared fallback, NOT EXECUTED. Requires acceptance of direct Apache startup # instead of the normal Laragon control mandated by the authorized procedure. # Exact existing configuration; no process termination, migration or key change. $ErrorActionPreference = 'Stop' $activationWorkspace = Split-Path -Parent $PSScriptRoot $activationPrivate = Join-Path $activationWorkspace 'storage/app/private/investmoz-v2/portal-audit' $activationStage = Get-Content -Raw -LiteralPath (Join-Path $activationPrivate 'stability-active-stage-latest.json') | ConvertFrom-Json if ($activationStage.delivery_revision -ne '485ee04c40b2754ab668f48fd84d8559fb19a8b98f4b9af50fc0517bb488ca76' -or -not $activationStage.syntax_verified) { throw 'Exact staged and syntax-verified authorized revision required.' } $activationPorts = @(Get-NetTCPConnection -State Listen -LocalPort 80,443 -ErrorAction SilentlyContinue) if ($activationPorts.Count -ne 0) { throw '80/443 already occupied; do not start another instance.' } $activationExecutable = 'C:/laragon/bin/apache/httpd-2.4.54-win64-VS16/bin/httpd.exe' $activationRoot = 'C:/laragon/bin/apache/httpd-2.4.54-win64-VS16' $activationConfig = 'C:/laragon/bin/apache/httpd-2.4.54-win64-VS16/conf/httpd.conf' $activationExisting = @(Get-CimInstance Win32_Process -Filter "Name='httpd.exe'" | Where-Object { $_.ExecutablePath -eq $activationExecutable.Replace('/','\') }) if ($activationExisting.Count -ne 0) { throw 'Original Apache remains loaded; no second instance permitted.' } if ((Get-FileHash -Algorithm SHA256 -LiteralPath "$activationRoot/bin/nghttp2.dll").Hash.ToLowerInvariant() -ne $activationStage.shared_DLL_sha256) { throw 'Shared DLL differs.' } Push-Location -LiteralPath $activationWorkspace try { & 'C:/laragon/bin/php/php-8.5.11-Win32-vs17-x64/php.exe' 'tools/portal-stability-activation-check.php' before-apply if ($LASTEXITCODE -ne 0) { throw 'Read-only code/configuration/key/data verification failed.' } & $activationExecutable -d $activationRoot -f $activationConfig -t if ($LASTEXITCODE -ne 0) { throw 'Exact Apache syntax differs.' } $activationInheritedPath = $env:Path try { # Child-only dependency lookup; no persistent Windows PATH or PHP ini modification. $env:Path = 'C:/laragon/bin/php/php-8.5.11-Win32-vs17-x64;' + $activationInheritedPath $activationProcess = Start-Process -FilePath $activationExecutable -ArgumentList @('-d',$activationRoot,'-f',$activationConfig) -WorkingDirectory "$activationRoot/bin" -WindowStyle Hidden -RedirectStandardOutput (Join-Path $activationStage.receipt_directory 'apache-controlled-start.stdout.txt') -RedirectStandardError (Join-Path $activationStage.receipt_directory 'apache-controlled-start.stderr.txt') -PassThru } finally { $env:Path = $activationInheritedPath } $activationStartReceipt = [ordered]@{at=(Get-Date).ToUniversalTime().ToString('o'); delivery_revision=$activationStage.delivery_revision; method='direct_Apache_existing_config_requires_explicit_acceptance'; PID=$activationProcess.Id; executable=$activationExecutable; config=$activationConfig; country_enabled=$false; installer_applied=$false; process_termination=$false; persistent_PATH_change=$false; database_writes=$false} $activationStartReceipt | ConvertTo-Json | Set-Content -Encoding utf8 -LiteralPath (Join-Path $activationPrivate 'stability-active-controlled-start.json') $activationStartReceipt | ConvertTo-Json -Compress } finally { Pop-Location }