<?php
$lane=$argv[1];$pid=$lane==='B'?10001:112175;
$root=$lane==='B'?'/tmp/zhct-http-store-mysql.dQTTBP':'/tmp/zhct-dm-poc-20260928.fcpiiN/store';
if(strpos((string)file_get_contents('/proc/'.$pid.'/cmdline'),$root.'/public')===false)throw new RuntimeException('Parent drift');
$env=[];foreach(explode("\0",(string)file_get_contents('/proc/'.$pid.'/environ'))as $item){$pair=explode('=',$item,2);if(count($pair)===2)$env[$pair[0]]=$pair[1];}
if(($env['POC_EXTERNAL_STUBS']??'')!=='1'||($env['POC_REAL_QUEUE']??'0')!=='0')throw new RuntimeException('Unsafe parent');
$env['PM_LANE']=$lane;$env['PM_ROOT']=$root;
$args=[$lane==='B'?'/usr/local/php7.3/bin/php':'/www/server/php/73/bin/php'];
if($lane==='C')array_push($args,'-c','/www/server/php/73/etc/php-cli.ini','-d','extension=/home/dmdba/dmdbms/drivers/php_pdo/libphp73_dm.so','-d','extension=/home/dmdba/dmdbms/drivers/php_pdo/php73_pdo_dm.so');
$script=file_get_contents($argv[2]);
$process=proc_open(implode(' ',array_map('escapeshellarg',$args)),[0=>['pipe','r'],1=>STDOUT,2=>STDERR],$pipes,null,$env);
fwrite($pipes[0],$script);fclose($pipes[0]);exit(proc_close($process));
