| 123456789101112131415161718 |
- param([string]$PhpBinary = (Get-Command php).Source)
- $ErrorActionPreference = 'Stop'
- $projectPath = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
- $oldScanPath = $env:PHP_INI_SCAN_DIR
- try {
- $modules = & $PhpBinary -m
- if ($LASTEXITCODE -ne 0) { throw 'PHP module check failed' }
- if ($modules -notcontains 'mbstring') {
- $extraIni = Join-Path $projectPath 'config\php'
- $env:PHP_INI_SCAN_DIR = if ($oldScanPath) { "$oldScanPath;$extraIni" } else { $extraIni }
- $modules = & $PhpBinary -m
- if ($modules -notcontains 'mbstring') { throw 'PHP mbstring extension could not be loaded' }
- }
- $process = Start-Process -FilePath $PhpBinary -ArgumentList @('windows.php','start') -WorkingDirectory $projectPath -WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $projectPath 'runtime\water-start.stdout.log') -RedirectStandardError (Join-Path $projectPath 'runtime\water-start.stderr.log')
- Write-Output "Started project PHP supervisor PID $($process.Id), mbstring enabled for child workers."
- } finally {
- $env:PHP_INI_SCAN_DIR = $oldScanPath
- }
|