PHP / Apache的崩溃的脚本(分段故障(11) [英] PHP/Apache crashing on script (Segmentation fault (11)
问题描述
[解决]
我在本地主机上的不断年底前崩溃运行PHP脚本(有一些包括)。
I'm running a PHP script (with some includes) on localhost that keeps crashing before the end.
错误报告上。歌剧,Safari和Firefox返回一个空的屏幕。
而Chrome返回:
Error reporting is on. Opera, Safari and Firefox return an empty screen. But Chrome returns:
,因此无法在服务器未发送任何数据加载网页。错误
code:ERR_EMPTY_RESPONSE
Unable to load the webpage because the server sent no data. Error code: ERR_EMPTY_RESPONSE
Apache日志的回报:
Apache logs returns:
[太阳12月15日19点29分23秒2013] [声明]儿童PID 34267退出信号
分段错误(11)
[Sun Dec 15 19:29:23 2013] [notice] child pid 34267 exit signal Segmentation fault (11)
使用PHP 5.5.6是当我遇到的第一次的问题
降级到PHP 5.4.21后问题依然存在。
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.
问题是不是在脚本中。随机注释掉一对夫妇50行code的解决了这个问题。让我不知道如果我的脚本可能是长期执行。
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?
更新:
问题并不只出现在本地主机也是对我的web服务器在CentOS 6.4和PHP 5.3.3运行给Apache的同样的错误。
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.
[太阳12月15日23时15分10秒2013] [声明]儿童PID 18409退出信号
分段错误(11)
[Sun Dec 15 23:15:10 2013] [notice] child pid 18409 exit signal Segmentation fault (11)
UPDATE2:
在命令行中运行PHP提供了:
Running php from the command line gives:
$ PHP的index.php致命错误:调用未定义的函数
mcrypt_create_iv()在Encrypt.class.php线135
$ php index.php Fatal error: Call to undefined function mcrypt_create_iv() in Encrypt.class.php on line 135
在Encrypt.class.php放置一个注释行135之前之后
After placing a comment before line 135 on Encrypt.class.php
$ PHP的index.php结果
段故障:11
$ php index.php
Segmentation fault: 11
UPDATE3:(解决方案)
与strace的(strace的PHP的index.php)上运行命令行的索引之后,我发现这个问题在查询之一。
After running the index on command line with strace (strace php index.php) I found the problem at one of the queries.
在一些更多的调试(使用,而不是我自己的类PDO)我发现的问题制定自己PDO选项ATTR_PERSISTENT =>真正的。禁用此选项解决了我的问题。
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:(解决方案)
UPDATE3: (Solution)
PDO的Persisten选择打破了我的表现够可悲的。
Persisten option of PDO broke my performance sadly enough.
发现strace的解决方案:
运行与strace的(strace的PHP的index.php)命令行的索引之后,我发现这个问题在查询之一。
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.
分离查询后我取代了我的类的默认PDO。添加我的课的选择,直到它再次被打破:
一些更多的调试(使用,而不是我自己的类PDO)后,我发现,这个问题是我的设置自己的PDO选项ATTR_PERSISTENT =>真正的。禁用此选项解决了我的问题。
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.
这篇关于PHP / Apache的崩溃的脚本(分段故障(11)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!