[英]Segmentation fault (core dumped) error - CodeIgniter application / Ubuntu 14.04 / PHP 5.5
Strange error within one CI application I am running on my localhost. 我在本地主机上运行的一个CI应用程序中出现奇怪的错误。 The error appeared after upgrading PHP to 5.5.
将PHP升级到5.5后出现错误。 The other apps on my localhost are running fine so likely something within the project code.
我的本地主机上的其他应用程序运行良好,因此项目代码中可能包含某些内容。 Can anyone suggest what I can configure differently or what might be chucking this error?
谁能建议我可以进行不同的配置,或者是什么可以消除此错误? I have read various other posts regarding the segmentation fault but nothing has applied
我已经阅读了其他有关细分错误的帖子,但没有任何应用
The apache log shows the following: apache日志显示以下内容:
[core:notice] [pid 1696] AH00051: child pid 5390 exit signal Segmentation fault (11), possible coredump in /etc/apache2
results of php version: php版本的结果:
$ php -v
PHP 5.5.9-1ubuntu4.4 (cli) (built: Sep 4 2014 06:56:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
If I run the app from the command line with strace (truncated for readability) 如果我使用strace从命令行运行该应用程序(出于可读性而被截断)
$ strace php index.php
....
mmap(NULL, 14963, PROT_READ, MAP_SHARED, 3, 0) = 0x7f0089e52000
munmap(0x7f0089e52000, 14963) = 0
close(3) = 0
brk(0x1bee000) = 0x1bee000
....
brk(0x25ae000) = 0x25ae000
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7fff07b47ff8} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
Anyone got any suggestions? 任何人有任何建议吗?
OK waste of time posting this in the end was fairly easy to find. 好的,浪费时间将其发布到最后很容易找到。 For some reason the following does not make for happy play - I was setting a protected variable of my MY_Model class directly using $this->config->item() and this was causing the issue.
由于某些原因,以下内容并不能使您玩得开心-我直接使用$ this-> config-> item()设置了MY_Model类的受保护变量,这引起了问题。
so if I do this: 所以如果我这样做:
public function __construct() {
parent::__construct();
$this->protected_var = $this->config->item('config_val','config_file');
}
It freaks out. 它吓坏了。 But if I use a setter function:
但是,如果我使用setter函数:
$this->setter($val = false){
if(!empty($val)){
$this->protected_var = $val;
}
}
Its fine. 没关系。 Pff!
PFF!
I found the same problem. 我发现了同样的问题。
To solve this i config my autoload do load my config file. 为了解决这个问题,我配置了我的自动加载功能,请加载我的配置文件。
In my case i create a config file: mongoci.php 在我的情况下,我创建一个配置文件:mongoci.php
So, in autoload.php i load the config file: 因此,在autoload.php中,我加载了配置文件:
$autoload['config'] = array('mongoci');
Please try include your config file. 请尝试包括您的配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.