ajax apache http javascript php

No php script can be run on server while there is another long-lasting php script running

I have a long-lasting PHP script running on server. It streams video to video tag from server (don’t ask me why I do it 🙂 ). It can run for tens of minutes.

The problem is that at the same time I want to send the request to server using AJAX and it doesn’t happen before the long script stops.

I’ve investigated the issue a bit more and I found out strange things.

  • While the long-lasting PHP script is running I can not call any PHP scripts (either AJAX or not) from the same browser.
  • Meanwhile from other browser server is accessible without problem.
  • Non-php assets (images, videos) can be accessed without problems.
  • In case video is played directly from .mp4 file the problem doesn’t exist. AJAX requests to php can be processed while video is played.

I’m curious what could cause this issue. From what I see it could be combination of server and browser configuration.

My question is why it happens and how can it be solved? I want to be able do the AJAX requests to the server while other PHP script is running in the same browser.

Here is an example of ‘stuck’ requests. First request is the video, second one is the AJAX which I want to send and it doesn’t go anywhere before 1st is completed.
enter image description here

As soon as 1st is completed the 2nd one is done immediately.
enter image description here

Web server is Apache 2. It was reproduced in IE and Chrome.

Ajax request is sent using just normal jQuery’s $.ajax() call.

Here is the request and response information for the video request that blocks AJAX request.

Request GET /portal/portlet/index/id/671/call/proxyVideo?entityId=1 HTTP/1.1
Accept */*
If-Unmodified-Since Fri, 24 Apr 2015 08:18:29 GMT
If-Match "f91b54d-514740a87ff40"
Range bytes=360448-261207372
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Referer http://mm.mac/content
GetContentFeatures.DLNA.ORG 1
Accept-Language en-US
Accept-Encoding gzip, deflate
Host mm.mac
Connection Keep-Alive
Cache-Control no-cache
Cookie PHPSESSID=41821op72k2s24mfrsbn5gad64
Response HTTP/1.1 206 Partial Content
Date Tue, 01 Dec 2015 13:39:31 GMT
Server Apache/2.4.16 (Unix) PHP/5.6.13
X-Powered-By PHP/5.6.13
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma no-cache
Last-Modified Fri, 24 Apr 2015 08:18:29 GMT
ETag "f91b54d-514740a87ff40"
Accept-Ranges bytes
Content-Length 260846925
Access-Control-Allow-Methods GET
Content-Range bytes 360448-261207372/261207373
Keep-Alive timeout=5, max=100
Connection Keep-Alive
Content-Type video/mp4