wordpress-playground
wordpress-playground copied to clipboard
Support requests to self (via an instance pool?)
Playground only runs a single PHP instance at the moment, which makes it impossible to request the following PHP file:
<?php
file_get_contents( get_site_url() . '/wp-admin/next.php' );
The file_get_contents()
request gets issued before the current PHP file is served, meaning there's no PHP instance to handle that request. This is how this may be communicated in the devtools:
Perhaps a pool of 3-4 PHP instances would be enough to solve most of these errors. This would be consistent with what php-fpm
does.
The only thing I'm worried about is the heap size – it's capped at 2GB at the moment, times 4 = 8GB. That's a lot of memory. I wonder if Playground could do away with, say, 256MB or 512MB memory limit.
Related issues
- https://github.com/WordPress/wordpress-playground/issues/1177
Also, this issue is a pre-requisite for:
- https://github.com/WordPress/wordpress-playground/issues/707
Requests flow through PHPBrowser
> PHPRequestHandler
> PHP
.
The PHPBrowser
keeps track of cookies, and any cookies should apply to all the PHP instances in the pool.
The PHPRequestHandler
represents a server in that it handles requests, URL rewriting, and stores config values like document root. It seems like it could accept an array of php
objects instead of just a single one, and then round-robin between them.