Yar 報錯 Yar_Client_Protocol_Exception

來源:互聯網
上載者:User
根據鳥哥部落格上Yar的介紹,書寫樣本時,報Yar_Client_Protocol_Exception錯誤,Google和Baidu都沒有查到解決辦法,各位大俠有沒有知道的呢?

yarServer.php

class API {    public function hello ($param = '')    {        return $param;    }    protected function hello2 ()    {    }}$service = new Yar_Server(new API());$service->handle();

yarClient.php

SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);//Set packager to JSON$client->SetOpt(YAR_OPT_PACKAGER, "json");$result = $client->hello('zhangsan');

錯誤詳情

Warning: [Debug Yar_Client 15:48:0.982003]: 2204859703: call api 'hello' at (r)'http://yar.demo.com/yarServer.php' with '1' parameters in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Warning: [Debug Yar_Client 15:48:0.982082]: 2204859703: pack request by 'JSON', result len '53', content: '{"i":2204859703,"m":"hello","p":' in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Fatal error: Uncaught exception 'Yar_Client_Protocol_Exception' with message 'malformed response header 'Warning: [Debug Yar_Server 15:4'' in /home/liuruntao/YarRPC-Demo/public/yarClient.php:10Stack trace:#0 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->__call('hello', Array)#1 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->hello('zhangsan')#2 {main}  thrown in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10

回複內容:

根據鳥哥部落格上Yar的介紹,書寫樣本時,報Yar_Client_Protocol_Exception錯誤,Google和Baidu都沒有查到解決辦法,各位大俠有沒有知道的呢?

yarServer.php

class API {    public function hello ($param = '')    {        return $param;    }    protected function hello2 ()    {    }}$service = new Yar_Server(new API());$service->handle();

yarClient.php

SetOpt(YAR_OPT_CONNECT_TIMEOUT, 1000);//Set packager to JSON$client->SetOpt(YAR_OPT_PACKAGER, "json");$result = $client->hello('zhangsan');

錯誤詳情

Warning: [Debug Yar_Client 15:48:0.982003]: 2204859703: call api 'hello' at (r)'http://yar.demo.com/yarServer.php' with '1' parameters in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Warning: [Debug Yar_Client 15:48:0.982082]: 2204859703: pack request by 'JSON', result len '53', content: '{"i":2204859703,"m":"hello","p":' in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10Fatal error: Uncaught exception 'Yar_Client_Protocol_Exception' with message 'malformed response header 'Warning: [Debug Yar_Server 15:4'' in /home/liuruntao/YarRPC-Demo/public/yarClient.php:10Stack trace:#0 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->__call('hello', Array)#1 /home/liuruntao/YarRPC-Demo/public/yarClient.php(10): Yar_Client->hello('zhangsan')#2 {main}  thrown in /home/liuruntao/YarRPC-Demo/public/yarClient.php on line 10

報錯的原因找到了,只要把yar的debug功能關掉就可以!

vim php.iniyar.debug=0 ;或者注釋掉

這樣是可以解決上述問題,樓主是否知道為啥會報這個warning,為啥呢?

  • 相關關鍵詞:
    相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.