PHP/Apache crashing on script (Segmentation fault (11)

[SOLVED]

I'm running a PHP script (with some includes) on localhost that keeps crashing before the end.

Error reporting is on. Opera, Safari and Firefox return an empty screen. But Chrome returns:

Unable to load the webpage because the server sent no data. Error code: ERR_EMPTY_RESPONSE

Apache logs returns:

[Sun Dec 15 19:29:23 2013] [notice] child pid 34267 exit signal Segmentation fault (11)

Was using PHP 5.5.6 when I encountered the problem for the first time After downgrading to PHP 5.4.21 the problem still exists.

The problem is not inside the script. Randomly commenting out a couple of 50 lines of code solves the problem. Making me wonder if my script might be to long for execution.

Does anyone has any suggestions on how I can resolve this problem?

UPDATE:

Problem doesn't only appears on the localhost but also on my webserver running on CentOs 6.4 and PHP 5.3.3 giving the same error on Apache.

[Sun Dec 15 23:15:10 2013] [notice] child pid 18409 exit signal Segmentation fault (11)

UPDATE2:

Running php from the command line gives:

$ php index.php Fatal error: Call to undefined function mcrypt_create_iv() in Encrypt.class.php on line 135

After placing a comment before line 135 on Encrypt.class.php

$ php index.php
Segmentation fault: 11

UPDATE3: (Solution)

After running the index on command line with strace (strace php index.php) I found the problem at one of the queries.

After some more debugging (using PDO instead of my own class) I found out that the problem was setting my own PDO option "ATTR_PERSISTENT => true". Disabling this option solved my problem.


UPDATE3: (Solution)

Persisten option of PDO broke my performance sadly enough.

Found the solution with strace: After running the index on command line with strace (strace php index.php) I found the problem at one of the queries.

After separating the query i replaced my class with default PDO. Adding options of my class till it was broken again: After some more debugging (using PDO instead of my own class) I found out that the problem was setting my own PDO option "ATTR_PERSISTENT => true". Disabling this option solved my problem.

链接地址: http://www.djcxy.com/p/63964.html

上一篇: 使用定义的边界在HTML5画布中拖动图像

下一篇: PHP / Apache崩溃脚本(分段错误(11)