简体   繁体   English

Apache崩溃-PHP

[英]Apache crash - PHP

UPDATED INFO: 更新信息:

OS Windows 7 32bit Apache 2.2.15 PHP 5.2.13 操作系统Windows 7 32位Apache 2.2.15 PHP 5.2.13


This is really weird. 这真的很奇怪。 When I got to this URI in my application: 当我在应用程序中到达此URI时:

/view/course/teid/1/cid/-1/pos/30

Apache crashes. Apache崩溃。

When I go to a very similar URI - like this one: 当我进入一个非常相似的URI时,就像这样:

/view/course/teid/1/cid/-1/pos/29

Everything works fine. 一切正常。

This is from error log: 这来自错误日志:

[Thu Aug 05 11:22:14 2010] [notice] Parent: child process exited with status 255 -- Restarting.

I have been able to track down the line which causes the Apache to crash: 我已经能够找到导致Apache崩溃的那一行:

if (true === $aCourseTree->SetNodePassed($node)) { // this line crashes Apache
    self::writeTreeToDb($aCourseTree, $training, $this->aUtils);
}

The method is here: 方法在这里:

public function SetNodePassed(CourseTreeNode $theNode)
{
    $aWasChange = !isset($theNode->Passed) || $theNode->Passed !== true;
    $theNode->Passed = true;

    if ($aWasChange && isset($theNode->Parent)) {
        if (true === $this->AreChildrenPassed($theNode->Parent)) {
            $this->SetNodePassed($theNode->Parent);
        }
    }
    return $aWasChange;
}

What the hell is going on? 这到底是怎么回事? If there is some error, it should just be a PHP error. 如果有错误,那应该只是PHP错误。 Why does Apache crash? 为什么Apache崩溃?

How are you running PHP in your Apache? 您如何在Apache中运行PHP?

mod_php can easily kill an Apache worker process[1], and the correct course of action for the Apache server as a whole is to try to return to as 'clean' a state as possible. mod_php可以很容易地杀死Apache辅助进程[1],而对于整个Apache服务器而言,正确的做法是尝试尽可能地恢复“干净”状态。 It is nearly impossible for a process to clean up after corrupted memory, but restarting is very safe and easy.[2] 内存损坏后,清理进程几乎是不可能的,但是重新启动非常安全且容易。[2] It goes a long way towards returning the system to a known-good state. 要使系统恢复到良好状态,还有很长的路要走。

You may wish to switch to a FastCGI implementation instead of mod_php ; 您可能希望切换到FastCGI实现而不是mod_php if you need more reasons, here's a very well-written set of reasons: 如果您需要更多原因,请参考以下精心编写的理由:

http://www.majordojo.com/2007/11/is-mod-php-falling-out-of-favor-with-hosting-providers.php http://www.majordojo.com/2007/11/is-mod-php-falling-out-of-favor-with-hosting-providers.php

[1] The PHP team asked Linux distribution security teams to stop calling php-interpreter crash bugs "security problems" -- they fixed those sorts of bugs so often, that remotely-exploitable security bugs in php and its libraries were getting drowned out in the noise. [1] PHP团队要求Linux发行版安全团队停止将php-interpreter崩溃错误称为“安全问题”,他们如此频繁地修复了此类错误,以致php及其库中的可远程利用的安全错误被淹没了。噪音。

[2] Of course, to re-execute itself, it would need to call one of the exec() functions on memory that could possibly be corrupted, but hopefully the only corrupted memory in the master Apache process would be the scoreboard. [2]当然,要重新执行自身,需要在内存上调用可能会损坏的exec()函数之一,但希望主Apache进程中唯一损坏的内存是记分板。 So a re-exec should be safe enough. 因此,重新执行程序应该足够安全。

尝试在您的php脚本顶部包含此内容,看看您遇到了什么错误

ini_set('error_reporting', E_ALL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM