Req #75235 [Opn]: Allow multi threads in PHP built in Server
| From: | requinix@php.net | Date: | Wed, 20 Sep 2017 14:52:02 +0000 |
| Subject: | Req #75235 [Opn]: Allow multi threads in PHP built in Server | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211272@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75235&edit=1
ID: 75235
Updated by: requinix@php.net
Reported by: mintystark at gmail dot com
Summary: Allow multi threads in PHP built in Server
Status: Open
Type: Feature/Change Request
Package: Built-in web server
Operating System: Ubuntu
PHP Version: 7.1.9
Block user comment: N
Private report: N
New Comment:
What you're describing won't work: since the server is single-threaded, it won't be
able to see the "additional process request". Faked multi-threading using multiple
processes on multiple ports is not really a good solution either.
Multi-threading is probably the correct answer here, or at least some other sort of master/slaves
architecture. I don't see any open *requests* to add that so I think I'll leave this as
is, but as far as I know there's still no desire to do it because the built-in server is
designed as a quick convenience and not a real web server.
Previous Comments:
------------------------------------------------------------------------
[2017-09-20 14:37:00] mintystark at gmail dot com
Description:
------------
Currently you can't spawn multi threads with the PHP Built in Server. I know that creating
such feature would take a lot of time and might require additional support from other packages, etc.
However, you can spawn multiple instances of the PHP Built in Server by launching it to other
Ports.
So I am suggesting that all is needed is the ability for the Built in Server to auto detect an
additional process and assign that process to any available ports that the built in server has
access to.
Ex.
php -S localhost:8000-80010 -t foo/
Or (Preferably)
php -S localhost:8000 -threadports 10 -t foo/
Or something like that
Which would spawn 10 additional instances of the Built in server from port 8001 to 8010.
Then if I am running a process on 8000 and make an addition process request on port 8000.
it will pass the process to the next available port 8001.
Like if I do a curl request to port 8000 or need any additional process requests like using exec()
or shell_exec() etc.
Currently running those commands with the built in web server on an existing process halts the
request until the command finishes. Even if you add the "&" at the end of the command
which should return the request immediately.
Example:
shell_exec('php -f "class.php" > /dev/null 2>&1 & echo $!);
Thanks
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75235&edit=1