I have encountered a problem using php's built in webserver, in that it appears to only allow a single concurrent connection.
I discovered this when testing some concurrent ajax requests which all appeared to complete at the same time.
This isnt a big deal, as i can always fire up apache (which is how i came to above conclusion), but i have gotten used to running php directly from my IDE.
Is there any way to increase this, or is it a php limitation?
my example code that blocks with the inbuilt server but works fine on apache:
$.ajax({
type: "POST",
url: slow.php,
data: "",
success: function(data){
clearInterval(checkid);
console.log('slow call finished');
}
});
checkid = setInterval(function(){
$.get('somefile.txt', function(data){
console.log('quick call finished');
});
},1000);
//slow.php
sleep(10);
echo 'all done';
What is the maximum number of concurrent TCP connections that a server can handle, in theory ? A single listening port can accept more than one connection simultaneously. There is a '64K' limit that is often cited, but that is per client per server port, and needs clarifying.
Concurrent Connection: The maximum amount of simultaneous connections your server can handle. Visitors: Someone who goes to your website.
PHP server is a collection of fundamental tools that make it easy to host at local servers so you can develop or built Web Apps at your computer. If you're are doing development on web application, having a PHP server is perfect way, the most perfect way to start.
Quoting from the manual:
PHP applications will stall if a request is blocked.
So yes, it's single threaded. Also, it's just an aid for development, in practice you'll seldom want to use it anyway as it doesn't support important external technologies like FallbackResource
, mod_rewrite
and .htaccess
which are intertwined with most web projects.
Modern IDEs like PhpStorm support automatic deployment on save to local and remote testing webservers, which is far more practical in projects larger than a handful of files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With