Segmentation Fault when running PHP Cli
When I type this in shell (Linux):
php index.php
Sometime PHP script terminate and I get an error saying:
Segmentation Fault
Sometime it work fine and sometime I get an error
In the php script it include PDO (mysql), Curl, some loop and "Simple HTML Dom" library
PHP Version:
username [~/www/]# php -v
PHP 5.2.9 (cli) (built: Oct 9 2010 02:01:46)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with开发者_如何学编程 the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by ionCube Ltd., and
with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technolog
How to fix this problem? I had no problem when I tested on Windows 7 (PHP 5.3.0).
It is about a memory access violation. In your case, this error may be due to (non-exhaustive list):
a stack overflow (often happens when the recursion level for a given function is too high)
too much data to be put in variables (e.g., you try to put the whole content of a huge file in a variable)
To know what causes trouble in your script, try commenting bigger and bigger parts to see which one is at the origin of the bug.
It seems your problem was solved earlier: PHP Out of Memory - Crashes Apache? May be the problem lies in memory leaks of Simple HTML Dom: http://simplehtmldom.sourceforge.net/manual_faq.htm#memory_leak
精彩评论