Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Max concurrent connections for php's built in development server

Tags:

php

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';
like image 468
Steve Avatar asked Jul 31 '14 15:07

Steve


People also ask

How many simultaneous connections can a concurrent server process allow?

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.

What is concurrent connections in hosting?

Concurrent Connection: The maximum amount of simultaneous connections your server can handle. Visitors: Someone who goes to your website.

What is a PHP web server?

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.


1 Answers

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.

like image 151
Niels Keurentjes Avatar answered Sep 18 '22 15:09

Niels Keurentjes