I’ve nginx + php-fpm(PHP8.3) installed on my Windows PC’s Docker Container(based on Ubuntu 24.04 amd64 image). and I have the following sample script test.php:
<?php
//exit(0);
sleep(60);
First, run this PHP script in the browser, this request will hang about 60 sec to simulate very long PHP executions. Then, before the previous page execution is fully finished, I removed the comment before exit(0), and fire another HTTP request via browser, but it seems the second request must waiting for the previous request finishing to start processing, why?
Here is the PHP-FPM Status Page result from nginx+php-fpm in my docker container:
(There is only one test.php in PHP-FPM Status Page while two test.php is still loading in browser, WHY?)
pid: 25
state: Running
start time: 15/Dec/2024:13:17:39 +0800
start since: 4242
requests: 21
request duration: 10050015
request method: GET
request URI: /test.php
content length: 0
user: -
script: /var/www/html/test.php
last request cpu: 0.00
last request memory: 0
P.S.1. I’ve tried the solution at PHP Page Stuck at Loading while Another PHP script is running, but not worked for me..
P.S.2 Also tried Show results while script is still executing, still not worked for me
P.S.3 I also tried install the following software to my docker container: apache2+php8.3/apache2+php8.3-fpm/nginx+php8.3-fpm, and tried install Laragon to run nginx+php 8.1 directly in my Windows PC. the issue still reproducable.
EDIT:
Here is the reproducible test steps:
Step 1. Access the script provided above from the browser.
Step 2. While previous script is still running, uncomment the code `//exit(0);` at line 2
Step 3. Open a new brower tab. Access the same script again.
You will see the Step 3 will load for a huge time until the running script from Step 1 is done.
I’ve confirmed that no (file-based) session is started/created during script running by checking session.auto_start at runtime (it outputs 0) and checking variable isset($_SESSION) (Result: false)