牛骨文教育服务平台(让学习变的简单)

首先感谢鸟哥,解决这个问题!这里做个简单的总结。

问题

在阿里云服务器上,安装了最新版本的yar和yii,上传了项目代码,但是调用yar封装的接口时,始终提示错误。

curl exec failed "Server returned nothing (no headers, no data)"

分析

查看错误日志,发现这样的问题。

GET /path/to/url HTTP/1.1" 500 16933 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0

服务器的500错误,再检查server的日志,httpd下的error_log。

 [Thu Jan 02 14:08:22 2014] [notice] child pid 29414 exit signal Segmentation fault (11)

发现的情况是这样的。

服务器没有打开coredump,所以暂时还没有core产生。

解决

然后,经过鸟哥4个小时的排查错误,发现,这是由于php5.3.3的bug导致的。

gdb作为测试工具,测试脚本。

修改了yii框架的代码。

/framework/web/actions/CInlineAction.php

原来是这样的

 public function runWithParams($params)
        {
                $methodName="action".$this->getId();
                $controller=$this->getController();
                $method=new ReflectionMethod($controller, $methodName);
                if($method->getNumberOfParameters()>0)
                        return $this->runWithParamsInternal($controller, $method, $params);
                else
                        return $controller->$methodName();
        }

修改后

 public function runWithParams($params)
        {
                $methodName="action".$this->getId();
                $controller=$this->getController();
                $method=new ReflectionMethod($controller, $methodName);
                if($method->getNumberOfParameters()>0)
                        $ret = $this->runWithParamsInternal($controller, $method, $params);
                else
                        $ret = $controller->$methodName();
                return $ret;
        }

这样就ok啦。

后记

鸟哥对自己的作品负责的态度真是佩服,连夜为我们测试,十分感动,谢谢鸟哥的帮助。

对于自己的知识体系来说,在linux上的测试环节和管理都是不熟悉的,一定会把这部分缺口补齐的!

加了个油!奋斗