Apache连接重置与preg_split

时间:2014-06-11 15:10:35

标签: php apache connection reset preg-split

我在使用Apache / 2.2.25(Win32)和PHP / 5.4.10时遇到了一个非常奇怪的行为,

我有这段代码

$content = <<<EOF
<UNICODE-WIN>
<Version:7><FeatureSet:InDesign-R2L><ColorTable:=<Black:COLOR:CMYK:Process:0,0,0,1>>
<DefineCharStyle:Character Style 1=<Nextstyle:Character Style 1><cTypeface:Bold Italic><cSize:19.000000><cCase:All Caps><cPosition:Normal><cKashida:Default>>
<DefineParaStyle:Paragraph Style 1=<Nextstyle:Paragraph Style 1><cTypeface:Bold Italic><cCase:All Caps>>
<DefineParaStyle:NormalParagraphStyle=<Nextstyle:NormalParagraphStyle>>
<ParaStyle:Paragraph Style 1><CharStyle:Character Style 1>Text Sample Text Sample Text Sample
<CharStyle:><ParaStyle:Paragraph Style 1>
<ParaStyle:NormalParagraphStyle><CharStyle:Character Style 1>
<CharStyle:><ParaStyle:NormalParagraphStyle>Text Sample Text Sample Text Sample Text Sample .
<CharStyle:><ParaStyle:NormalParagraphStyle>aa aaaaa aaaa  \\\<bbbbbbb\\\\\>cccccc
<ParaStyle:NormalParagraphStyle>
Text Sample Text Sample Text Sample Text Sample Text Sample Text Sample
<ParaStyle:NormalParagraphStyle><CharStyle:Character Style 1>Text Sample
<CharStyle:><ParaStyle:NormalParagraphStyle>
Text Sample Text Sample Text Sample Text Sample Text Sample
<ParaStyle:NormalParagraphStyle>Text Sample Text Sample Text Sample Text Sample
<ParaStyle:NormalParagraphStyle><CharStyle:Character Style 1><cNextXChars:Column>
<CharStyle:><ParaStyle:NormalParagraphStyle><cNextXChars:Column>
<ParaStyle:NormalParagraphStyle>Text Sample Text Sample
<ParaStyle:NormalParagraphStyle>
EOF;
$regex         = '/((<(([^<>]|<[^<>]*>)*)>\s*)+)/s';
$parts         = preg_split( $regex, $content, null, PREG_SPLIT_OFFSET_CAPTURE | PREG_SPLIT_NO_EMPTY );

由于某些原因,当我执行此代码时,它会导致浏览器中的连接重置页面,Apache或PHP中没有错误日志

在线进行了一些研究,但找不到合适的解决方案,

以下是results of phpinfo page on the Windows server

的链接

另请注意,我在其他服务器Windows和CentOS上运行相同的代码,它工作得很好

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

我能够通过将ThreadStackSize增加到8 MB而不是默认的Windows值1 MB来修复此问题,您只需要将这些行添加到Apache conf文件中

<IfModule mpm_winnt_module>
   ThreadStackSize 8388608
</IfModule>