Bug #65453 [Fbk]: Readfile() + mpg = http status 500, windows server 2008 r2 sp1, php 5.5.1
| From: | ab@php.net | Date: | Tue, 20 Aug 2013 13:15:53 +0000 |
| Subject: | Bug #65453 [Fbk]: Readfile() + mpg = http status 500, windows server 2008 r2 sp1, php 5.5.1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181047@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65453&edit=1
ID: 65453
Updated by: ab@php.net
Reported by: oli dot laurel at arcor dot de
Summary: Readfile() + mpg = http status 500, windows server
2008 r2 sp1, php 5.5.1
Status: Feedback
Type: Bug
Package: IIS related
Operating System: Windows Server 2008 R2 SP1
PHP Version: 5.5.1
Block user comment: N
Private report: N
New Comment:
CLI server also shows 200. It'd make sense to ask on IIS forums as well, as
nothing points to PHP yet.
Previous Comments:
------------------------------------------------------------------------
[2013-08-20 12:34:12] ab@php.net
I've just tried this with a text file of 6M with no reproduce.
Please post the output of these commands
wget --server-response --limit-rate=40000 http://127.0.0.1/65453/index.php
You can also try curl. It's available for windows or with msysgit shell
curl -v --limit-rate 40000 -o /dev/null http://127.0.0.1/65453/index.php
Thanks
------------------------------------------------------------------------
[2013-08-16 07:45:46] oli dot laurel at arcor dot de
hi,
thank you for reply.
- does the same happen when you out a plain text file instead of mpeg, also using appropriate
content-type and --limit-rate?
i changed content-type to text/plain and renamed movie.mpg to movie.txt. No behaviour change. If i
abort download i will also get a 500.
- does it happen when you request static content using wget with --limit-rate?
no, if i just download a file for example http://127.0.0.1/movie.mpg all works fine. Also if i abort
download.
Please use following configuration:
Description
------------
- Installed a blank Windows Server 2008 R2 SP1 Standard, added Role IIS & Feature CGI.
- Extracted 5.5.1 VC11 x86 Non Thread Safe to c:\Program Files (x86)\php
- Installed vcredist_x86.exe
- Configuration of IIS:
added Handler Mappings in IIS
Request path: *.php
Module: FastCgiModule
Executable: c:\Program Files (x86)\php\php-cgi.exe
Name: PHP via FastCgi
- Then added 2 files to C:\inetpub\wwwroot index.php & movie.mpg (6MB)
- add download.cmd to c:
- Installed wget.
- No modification of php.ini, no malware scanner, ...
- start c:\download.cmd
[download.cmd]
--------------
"C:\Program Files\GnuWin32\bin\wget.exe" --limit-rate=20000 http://127.0.0.1/index.php
[Console Output]
----------------
C:\>"C:\Program Files\GnuWin32\bin\wget.exe" --limit-rate=20000 http://127.0.0.1
/index.php
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files\GnuWin32/etc/wgetrc
--2013-08-16 09:35:00-- http://127.0.0.1/index.php
Verbindungsaufbau zu 127.0.0.1:80... verbunden.
HTTP Anforderung gesendet, warte auf Antwort... 200 OK
Länge: 6702080 (6,4M) [text/plain]
In »index.php.7« speichern.
62% [=======================> ] 4.193.792 --.-K/s in 5m 33s
2013-08-16 09:40:35 (12,3 KB/s) - Lesefehler bei Byte 4193792/6702080 (Connectio
n reset by peer). Erneuter Versuch.
--2013-08-16 09:40:36-- (Versuch: 2) http://127.0.0.1/index.php
Verbindungsaufbau zu 127.0.0.1:80... verbunden.
HTTP Anforderung gesendet, warte auf Antwort... 200 OK
Länge: 6702080 (6,4M) [text/plain]
In »index.php.7« speichern.
1% [ ] 131.072 19,5K/s eta 8m 59s
[index.php]
-----------
<?php
$track = "movie.txt";
if (file_exists($track)) {
header("Content-Type: text/plain");
header('Content-Length: ' . filesize($track));
header('Content-Disposition: inline; filename="movie.txt"');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
readfile($track);
exit;
} else {
header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
echo "no file";
}
?>
[movie.txt] 6MB (no change if its a real movie or not)
---------------
asdfghasdfghasdfgh...
[w3svc1.log]
------------
#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2013-08-16 07:38:26
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent)
sc-status sc-substatus sc-win32-status time-taken
2013-08-16 07:38:26 127.0.0.1 GET /index.php - 80 - 127.0.0.1 Wget/1.11.4 500 0 2147500037 205717
2013-08-16 07:41:04 127.0.0.1 GET /index.php - 80 - 127.0.0.1 Wget/1.11.4 500 0 64 28672
------------------------------------------------------------------------
[2013-08-15 16:21:36] ab@php.net
This looks like server misconfig at first glance. In the BT there is nothing about PHP. Combined
with
the fact you find nothing in the error log, it might be not PHP.
How did you get that BT? Debug symbols should be used for PHP as well. And when IIS starts, you
should
attach the debugger to the clean PHP fcgi process, so then debugger takes over.
Some more points before i go try it
- does the same happen when you out a plain text file instead of mpeg, also using appropriate
content-
type and --limit-rate?
- does it happen when you request static content using wget with --limit-rate?
- please post the request/response headers
Thanks.
------------------------------------------------------------------------
[2013-08-15 07:41:11] oli dot laurel at arcor dot de
Description:
------------
- Installed a blank Windows Server 2008 R2 SP1 Standard, added Role IIS & Feature CGI.
- Extracted 5.5.1 VC11 x86 Non Thread Safe to c:\Program Files (x86)\php
- Installed vcredist_x86.exe
- Configuration of IIS:
added Handler Mappings in IIS
Request path: *.php
Module: FastCgiModule
Executable: c:\Program Files (x86)\php\php-cgi.exe
Name: PHP via FastCgi
- Then added 2 files to C:\inetpub\wwwroot index.php & movie.mpg (6MB)
- Installed wget.
- No modification of php.ini, no malware scanner, ...
Every time i download index.php with following script i get an HTTP-Status 500 in Access Log.
[download.cmd]
"C:\Program Files (x86)\GnuWin32\bin\wget.exe" --limit-rate=40000
http://127.0.0.1/index.php
Multiple downloads cause the server to crash and return Status 500 for every request (normal html
pages, images, text files, ...).
Hope backtrace helps to find the problem.
Thread 6 - System ID 3884
Entry point w3tp+2040
Create time 12.08.2013 14:08:38
Time spent in user mode 0 Days 0:0:0.0
Time spent in kernel mode 0 Days 0:0:0.0
Full Call Stack
Function Arg 1 Arg 2 Arg 3 Arg 4 Source
ntdll!NtTerminateProcess 00000000
03212eb0 0000000002a7a800
0000000000000001 0000000000000000
KERNELBASE!TerminateProcess+2f 0000000000ff6ae0 00000000778f598e
0000000001c869f0 0000000000000000
iisfcgi+94da 0000000000ff3410 0000000000fe0cf0 00000000800703e3
00000000778c8884
iisfcgi+68aa 0000000000ff3410 0000000000000010 000000000045d6b0
00000000004637e0
iisfcgi+556f 0000000000000000 00000000800703e3 00000000027e12f8
000007fef5db6585
iisfcgi+105f6 0000000000000000 0000000000020000 0000000000fe0cf0
0000000000000000
iiscore+ba3c 00000000019d46c8 0000000000000000 0000000000000000
00000000778ac1e0
iiscore+46a4 00000000779a4440 00000000019d46c0 00000000019d46c8
0000000000000001
iiscore+a775 0000000000000000 0000000002753a30 0000000000000008
0000000002753c28
iiscore+5a03 00000000019d46c0 0000000000020000 00000000019d46c0
0000000000000000
iiscore+1741 00000000005134d0 0000000000000000 0000000000000000
000007fef70c1107
w3dt!UlAtqGetContextProperty+a2 00000000005134d0 0000000000000000
000007fefaeb0000 0000000000000000
w3dt!UlAtqGetContextProperty+8c 0000000000000000 000007fefde3379b
0000000000000000 0000000000000000
w3tp+1fba 0000000000020000 00000000019d3aa8 000007fefaa31080
0000000000000000
w3tp+2024 0000000000000000 00000000004be870 00000000004be870
000007fefaeb0000
w3tp+20a1 0000000000000000 0000000000000000 0000000000000000
0000000000000000
kernel32!BaseThreadInitThunk+d 0000000000000000 0000000000000000
0000000000000000 0000000000000000
ntdll!RtlUserThreadStart+21 0000000000000000 0000000000000000
0000000000000000 0000000000000000
Exception Information
In
w3wp__DefaultAppPool__PID__3596__Date__08_12_2013__Time_02_09_39PM__703__ntdll!ZwTerminateProcess.dmp
the assembly instruction at ntdll!DbgBreakPoint in C:\Windows\System32\ntdll.dll from Microsoft
Corporation has caused a breakpoint exception (0x80000003) on thread 6
Module Information
Image Name: C:\Windows\System32\ntdll.dll Symbol Type: Export
Base address: 0x00000003`00905a4d Time Stamp: Thu Nov 17 07:32:46 2011
Checksum: 0x00000000`00000000 Comments:
COM DLL: False Company Name: Microsoft Corporation
ISAPIExtension: False File Description: NT Layer DLL
ISAPIFilter: False File Version: 6.1.7601.17725 (win7sp1_gdr.111116-1503)
Managed DLL: False Internal Name: ntdll.dll
VB DLL: False Legal Copyright: © Microsoft Corporation. All rights reserved.
Loaded Image Name: ntdll.dll Legal Trademarks:
Mapped Image Name: Original filename: ntdll.dll
Module name: ntdll Private Build:
Single Threaded: False Product Name: Microsoft® Windows® Operating System
Module Size: 1,66 MBytes Product Version: 6.1.7601.17725
Symbol File Name: ntdll.dll Special Build: &
Test script:
---------------
[index.php]
<?php
$track = "movie.mpg";
if (file_exists($track)) {
header("Content-Type: audio/mpeg");
header('Content-Length: ' . filesize($track));
header('Content-Disposition: inline; filename="movie.mpg"');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
readfile($track);
exit;
} else {
header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404);
echo "no file";
}
?>
[download.cmd]
"C:\Program Files (x86)\GnuWin32\bin\wget.exe" --limit-rate=40000
http://127.0.0.1/index.php
Expected result:
----------------
HTTP Status in Access-Log of IIS should be 200
Actual result:
--------------
Every time file is downloaded with "--limit-rate=40000" Access Log show HTTP Status 500.
No entries can by found in php Log.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65453&edit=1