2

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).

2
  • 1
    Its going to be very hard to figure out if the script is not attached. I would try to get a minimal script that can reproduce the problem (with a combination of pdo/curl etc) and post that here. The other option is to do an strace when you run the command (lookup man strace for options).b Commented Jul 6, 2011 at 17:13
  • 3
    I would first remove ionCube from the list of extensions and then try again. If it still fails, I would remove the Zend Optimizer as well. Then if it still fails, I think the suggestion from rajasaur is a good way to find out more. Alternatively, run the script in GDB. Commented Jul 6, 2011 at 17:14

2 Answers 2

3

It is about a memory access violation. In your case, this error may be due to (non-exhaustive list):

  1. a stack overflow (often happens when the recursion level for a given function is too high)

  2. 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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

A segmentation fault is not the same as an OOM error. See the response from Mathieu Rodic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.