PHP - “Segmentation fault (core dumped)”-Error 是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15714909/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 09:49:13  来源:igfitidea点击:

PHP - What does "Segmentation fault (core dumped)"-Error means?

php

提问by Crayl

I wrote a simple crawler using Simple HTML Dom Parser to scrape some stuff.

我使用 Simple HTML Dom Parser 编写了一个简单的爬虫来抓取一些东西。

It's a simple script only running with 1 process and nothing massive. But after some time it produces a "Segmentation fault (core dumped)"-error,when I am running it in the shell.

这是一个简单的脚本,只运行 1 个进程,没什么大不了的。但是一段时间后,"Segmentation fault (core dumped)"-error,当我在 shell 中运行它时,它会产生一个。

When I run the script in the browser it says

当我在浏览器中运行脚本时,它说

"Error: The connection to the server was reset while the page was loading.".

I have made sure to unset()every variable as soon as possible and also increased the memory_limitin php.ini, but still I get this error :/

我已确保unset()尽快确定每个变量并增加了memory_limitin php.ini,但我仍然收到此错误:/

Does someone know what it means and how to solve it?

有人知道这是什么意思以及如何解决吗?

Thanks for any suggestions!

感谢您的任何建议!

回答by Visti K

I have this problem when a made a recursive loop by accident, so it runs out of memory. But the way it tells me is by making a Segmentation fault (core dumped)error!

当 a 意外进行递归循环时,我遇到了这个问题,因此内存不足。但它告诉我的方式是Segmentation fault (core dumped)犯错误!

So look a the code you most recently wrote and check if you made a error like this! My example was very simple (and stupid). I was just a little to fast to accept the autocomplete's suggestion :)

因此,查看您最近编写的代码并检查您是否犯了这样的错误!我的例子非常简单(而且很愚蠢)。我只是有点快接受自动完成的建议:)

public function getAttendees()
{
    return $this->getAttendees();
}

Hope this can help someone in the future

希望这可以帮助将来的某人

回答by Crayl

If anybody else has the same problem with Simple HTML Dom Parser: In this case the error was caused because of too long webpages. SHDP has a preconfigured "MAX_FILE_SIZE". You have to increase it in the source of simple_html_dom.php. See line:

如果其他人对 Simple HTML Dom Parser 有同样的问题:在这种情况下,错误是由于网页太长造成的。SHDP 有一个预配置的“MAX_FILE_SIZE”。您必须在simple_html_dom.php. 见行:

define('MAX_FILE_SIZE', 600000);

回答by Artjom Kurapov

I've had it because free HDD space in VM ended due to too much data in /tmp folder

我已经有了它,因为 VM 中的可用硬盘空间由于 /tmp 文件夹中的数据过多而结束

回答by Salvi Pascual

The 'core dumped' I think just means the program released the memory and exited.

“核心转储”我认为只是意味着程序释放了内存并退出。

A segmentation fault usually occurs when you try and access a part of memory that is not yours to use, or by deferencing an uninitialised or invalid pointer.

当您尝试访问不属于您的部分内存或延迟未初始化或无效的指针时,通常会发生分段错误。

Could you be passing/using a bad handle or overrunning an array somewhere?

您是否可以传递/使用错误的句柄或在某处溢出数组?

回答by Ian

I just has same issue. I was doing

我只是有同样的问题。我在做

return $var;

Which caused the error. However returning

这导致了错误。然而返回

return [$var][0];

worked. I'm sure there is a good explanation for this but I don't know it.

工作。我确信对此有一个很好的解释,但我不知道。