File tree Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ export class PlaygroundCliBlueprintV1Worker extends PHPWorker {
151
151
152
152
const requestHandler = await bootWordPress ( {
153
153
siteUrl,
154
- createPhpRuntime : async ( ) => {
154
+ createPhpRuntime : async ( isPrimary ) => {
155
155
const processId = nextProcessId ;
156
156
157
157
if ( nextProcessId < lastProcessId ) {
@@ -166,9 +166,13 @@ export class PlaygroundCliBlueprintV1Worker extends PHPWorker {
166
166
fileLockManager : this . fileLockManager ! ,
167
167
processId,
168
168
trace : trace ? tracePhpWasm : undefined ,
169
- phpWasmInitOptions : {
170
- nativeInternalDirPath,
171
- } ,
169
+ phpWasmInitOptions : isPrimary
170
+ ? // Only pass a native /internal dir to the primary PHP process
171
+ // because the secondary PHP process will proxy to it.
172
+ {
173
+ nativeInternalDirPath,
174
+ }
175
+ : { } ,
172
176
} ,
173
177
followSymlinks,
174
178
withXdebug,
Original file line number Diff line number Diff line change @@ -386,7 +386,7 @@ export class PlaygroundCliBlueprintV2Worker extends PHPWorker {
386
386
try {
387
387
const requestHandler = await bootRequestHandler ( {
388
388
siteUrl,
389
- createPhpRuntime : async ( ) => {
389
+ createPhpRuntime : async ( isPrimary ) => {
390
390
const processId = nextProcessId ;
391
391
392
392
if ( nextProcessId < lastProcessId ) {
@@ -404,9 +404,13 @@ export class PlaygroundCliBlueprintV2Worker extends PHPWorker {
404
404
ENV : {
405
405
DOCROOT : '/wordpress' ,
406
406
} ,
407
- phpWasmInitOptions : {
408
- nativeInternalDirPath,
409
- } ,
407
+ phpWasmInitOptions : isPrimary
408
+ ? // Only pass a native /internal dir to the primary PHP process
409
+ // because the secondary PHP process will proxy to it.
410
+ {
411
+ nativeInternalDirPath,
412
+ }
413
+ : { } ,
410
414
} ,
411
415
followSymlinks : allow ?. includes ( 'follow-symlinks' ) ,
412
416
withXdebug,
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export interface Hooks {
37
37
export type DatabaseType = 'sqlite' | 'mysql' | 'custom' ;
38
38
39
39
export interface BootRequestHandlerOptions {
40
- createPhpRuntime : ( ) => Promise < number > ;
40
+ createPhpRuntime : ( isPrimary ?: boolean ) => Promise < number > ;
41
41
onPHPInstanceCreated ?: ( php : PHP ) => Promise < void > ;
42
42
/**
43
43
* PHP SAPI name to be returned by get_sapi_name(). Overriding
@@ -199,7 +199,8 @@ export async function bootRequestHandler(options: BootRequestHandlerOptions) {
199
199
requestHandler : PHPRequestHandler ,
200
200
isPrimary : boolean
201
201
) {
202
- const php = new PHP ( await options . createPhpRuntime ( ) ) ;
202
+ const runtimeId = await options . createPhpRuntime ( isPrimary ) ;
203
+ const php = new PHP ( runtimeId ) ;
203
204
if ( options . sapiName ) {
204
205
php . setSapiName ( options . sapiName ) ;
205
206
}
You can’t perform that action at this time.
0 commit comments