Apache (php)在同时调用2个或更多php文件时崩溃


Apache (php) crashes when calling 2 or more php files at the same time

我需要从数据库中加载多个文件,我使用php来完成。

当我同时加载两个php文件(它们可以是具有不同get变量的相同文件或不同文件)时,这两个文件都崩溃了。我尝试使用旧版本的xampp,但出现了同样的问题。

编辑:我注意到它只发生在使用浏览器palemoon(我使用24.7.1 x64版本)。Chrome、Opera和Firefox都运行良好。我不明白为什么。

要复制它,我只需要创建一个html文件index.html,内容如下:
<!doctype html>
<html>
<head>
    <link rel="stylesheet" href="a.php"/>
    <link rel="stylesheet" href="b.php"/>
</head>
</html>

现在,创建两个空白文件,一个名为a.p p,另一个名为b.p p(不管其中写了什么)

最后在浏览器上打开html并按ctrl-f5直到apache崩溃。

apache记录的唯一内容是

[Tue Aug 12 04:38:14.576000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00428: Parent: child process 3368 exited with status 3221225477 -- Restarting.
[Tue Aug 12 04:38:14.686000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00455: Apache/2.4.10 (Win32) PHP/5.4.31 configured -- resuming normal operations
[Tue Aug 12 04:38:14.686000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00456: Apache Lounge VC10 Server built: Jul 19 2014 11:02:31
[Tue Aug 12 04:38:14.686000 2014] [core:notice] [pid 3880:tid 148] AH00094: Command line: 'C:''UniServerZ''core''apache2''bin''httpd_z.exe -d C:/UniServerZ/core/apache2 -f C:''UniServerZ''core''apache2''conf''httpd.conf -d C:''UniServerZ''core''apache2'
[Tue Aug 12 04:38:14.688000 2014] [mpm_winnt:notice] [pid 3880:tid 148] AH00418: Parent: Created child process 5040
[Tue Aug 12 04:38:15.267000 2014] [mpm_winnt:notice] [pid 5040:tid 568] AH00354: Child: Starting 150 worker threads.

我发现了这个bug报告,但最后一个条目是从2004年开始的,所以我想知道这个问题是否是一个bug,如果是,是相同的bug: https://bugs.php.net/bug.php?id=25570

编辑:使用c#有时会使服务器崩溃
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
class MainClass
{
    public static void Main (string[] args)
    {
        IPAddress ipAddress = Array.FindAll(
            Dns.GetHostEntry("127.0.0.1").AddressList,
            a => a.AddressFamily == AddressFamily.InterNetwork)[0];
        IPEndPoint remoteEP = new IPEndPoint(ipAddress,80);
        Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
        string request = "GET /a.php HTTP/1.1'r'n" + 
            "Host: 127.0.0.1'r'n" +
            "'r'n";
        sender.Connect(remoteEP);
        sender.Send (Encoding.UTF8.GetBytes (request));
        sender.Send (Encoding.UTF8.GetBytes (request));
        byte[] buffer = new byte[4096];
        int nBytes = 0;
        try {
            while ((nBytes = sender.Receive(buffer,4096, SocketFlags.None)) > 0)
            {
                // From byte array to string
                string s = Encoding.UTF8.GetString(buffer, 0, nBytes);
                Console.WriteLine(s);
            }
        } catch (SocketException e) {
            Console.WriteLine("error {0}", e.ErrorCode);
        }
        Console.WriteLine("'nPress a key...");
        Console.ReadKey();
    }
}
编辑:我在windows xampp服务器上使用Connection: Close来避免这个问题。我的linux vps工作完美,它只发生在windows服务器上
我不太明白你的问题,但我想这就是你的意思。你不能使用<link rel="stylesheet" />来包含一个php文件。

为了包含php代码,您必须执行以下操作:

<!doctype html>
<html>
    <head>
       <!-- <link rel="stylesheet" href="a.php"/>
       <link rel="stylesheet" href="b.php"/> -->
    </head>
<?php
 require "a.php";
 require "b.php";
?>
</html>