Req #75235 [Opn]: Allow multi threads in PHP built in Server

From: Date: Wed, 20 Sep 2017 21:02:51 +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-211280@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: 67884 was a bug report. I considered closing this one as NAB/wontfix like it based on precedence but decided against it. 66690 was an unrelated issue. > Then I will make a new request for it. You already have a request for it: this one. > shell_exec() does not allow for selecting which port Of course not: shell_exec has nothing to do with networking. I'm not sure what port you're trying to select with it but I'm pretty sure it is actually possible. Previous Comments: ------------------------------------------------------------------------ [2017-09-20 20:57:56] mintystark at gmail dot com Then I will make a new request for it. I do appreciate the Built in Server and it has made quick development very nice, but I have been finding myself having to setup Nginx many times because my tests require multi threading. At which point the built in server hasn't been useful. I have had to start up multiple ports and send the additional commands to the other ports, (ie cUrl) which works fine. However, running functions like shell_exec() does not allow for selecting which port so I have to use nginx. I understand that my scenario might be a use case, but I have found other comments requesting that the Built in server should allow multi threading so I think it would be very beneficial. Thanks https://stackoverflow.com/questions/39842170/load-balancing-php-built-in-server https://bugs.php.net/bug.php?id=67884 https://stackoverflow.com/questions/29173953/php-built-in-server-cant-curl https://bugs.php.net/bug.php?id=66690 ------------------------------------------------------------------------ [2017-09-20 14:51:58] requinix@php.net 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#211280) next »