laruence / yar Goto Github PK
View Code? Open in Web Editor NEWLight, concurrent RPC framework for PHP & C
License: Other
Light, concurrent RPC framework for PHP & C
License: Other
我试了一下 README.md 中的并发的例子,发现了一些问题,其中一个是这样的。
Server:
<?php
class API {
/**
* the doc info will be generated automatically into service info page.
* @params
* @return
*/
public function some_method($parameter, $option = "foo") {
return $parameter;
}
protected function client_can_not_see() {
}
}
$service = new Yar_Server(new API());
$service->handle();
Client:
function callback($retval, $callinfo) {
var_dump($retval);
}
function error_callback($type, $error, $callinfo) {
error_log($error);
}
Yar_Concurrent_Client::call("http://192.168.200.192:2002/Api.php", "some_method", array("parameters"), "callback");
Yar_Concurrent_Client::loop("callback", "error_callback");
理论上,应该返回值应该是这样的string(10) "parameters"
,但是我得到的返回值却是NULL string(10) "parameters"
,多了一个 NULL。
多次测试后,我发现是 callback 函数在调用 loop 之后被调用了一次,这似乎是一个 bug...
试了几次,情况大概是这样的:
Yar_Concurrent_Client::call
则没有额外的 callback 调用打开了 log,看上去还挺正常的:
[18-Nov-2013 13:03:56 UTC] PHP Warning: [Debug Yar_Client 21:3:56.67954]: 2947065551: call api 'some_method' at (r)'http://192.168.200.192:2002/Api.php' with '1' parameters in /***/Test.php on line 16
[18-Nov-2013 13:03:56 UTC] PHP Warning: [Debug Yar_Client 21:3:56.68094]: 2947065551: pack request by 'PHP', result len '98', content: 'a:3:{s:1:"i";i:2947065551;s:1:"m' in /***/Test.php on line 16
[18-Nov-2013 13:03:56 UTC] PHP Warning: [Debug Yar_Client 21:3:56.69905]: 2947065551: server response content packaged by 'PHP', len '88', content 'a:4:{s:1:"i";i:2947065551;s:1:"s' in /***/Test.php on line 16
然后我的 PHP 是 5.3.10,yar 是 1.2.0。
另外顺便问下,yar 已经有在生产环境使用了么?看 http://www.laruence.com/2013/08/15/2913.html 这里的 slide 似乎已经在微博用了。
在调用github里的一个例子时,出了下面的警告
Warning: Yar_Concurrent_Client::loop(): can not get fd from curl instance,
这可能是什么原因造成的?
配合 openrestry 玩,很合适啊, 它专做api
由于接口会曝露在外网(跨机房调用),希望可以在yar加权限认证。
系统:centos 7,
php:版本:7.0
yar:版本2.0.0
错误详情:
Type: Yar_Client_Transport_Exception
Message: server responsed non-200 code '403'
[12-Jan-2016 07:28:14 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted at /Users/php/php-7.0.1/Zend/zend_smart_str.c:45 (tried to allocate 8589938656 bytes) in /Code/Service/application/modules/Default/controllers/Service.php on line 43
YAR_OPT_TIMEOUT会覆盖yar.timeout的设置,算合理不?
为什么新版要去掉provider和token的支持呢?是出于什么考虑?
in README.md, yar.packager has spelling by yar.packger
请求地址为什么不采用直接一个地址的方式呢,而要采用地址+方法的形式,这样使得面向过程写法的接口没办法被yar这种方式调用,这种情况有办法解决么 @鸟哥
yar_Client_Transport_Exception: server responsed non-200 code '403' in /mnt/hgfs/workspace/test/index.php on line 13
Fedora Packaging Guidelines requires that each RPM includes the LICENSE file, when provided by upstream, and to request for it when missing.
So I do.
http://fedoraproject.org/wiki/Packaging/LicensingGuidelines#License_Text
鸟哥你好,我在windows下用了yar.dll,是在pecl下载的。
PHP5.4,curl7.29
但是也是一直报这个错误。
[23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.271401]: 440193860: call api 'add' at (r)'http://test.me/server.php' with '2' parameters in D:\httproot\test\client.php on line 13
[23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.274330]: 440193860: pack request by 'PHP', result len '82', content: 'a:3:{s:1:"i";i:440193860;s:1:"m"' in D:\httproot\test\client.php on line 13
[23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.277817]: -1015573128: call api 'mul' at (r)'http://test.me/server.php' with '2' parameters in D:\httproot\test\client.php on line 13
[23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: [Debug Yar_Client 9:50:32.280518]: -1015573128: pack request by 'PHP', result len '84', content: 'a:3:{s:1:"i";i:-1015573128;s:1:"' in D:\httproot\test\client.php on line 13
[23-Jul-2014 09:50:32 Asia/Shanghai] PHP Warning: Yar_Concurrent_Client::loop(): can not get fd from curl instance in D:\httproot\test\client.php on line 13
但是用$client->add();这种一个个来的就没问题了,但百度下这个问题,貌似没有结果
官网也没看到有关windows下的介绍。所以麻烦鸟哥了,谢谢。
你好,对于yar有个疑问
一个页面有多个模块,其中部分模块的数据要依赖其他模块获取的接口数据
所以我就先使用
Yar_Concurrent_Client::call(A)
Yar_Concurrent_Client::call(B)
Yar_Concurrent_Client::loop();
得到数据之后供其他模块接口调用
Yar_Concurrent_Client::call(C)
Yar_Concurrent_Client::call(D)
Yar_Concurrent_Client::loop();
这时我发现之前的A B调用会被再次调用
这种该如何避免呢?
服务端的代码依赖Header和Cookie,Yar_Client能添加自定Header或Cookie吗?
用Yar_Concurrent_Client::call 调用,loop调用后一直超时。即使只call 了一次。
用Yar_Client 同步调用就没问题,同样的协议。
我用的php 5.4.17, osx10.9
请问鸟哥有没有C语言实现的Server端的例子?谢谢!
1、yar使用的是仓库中直接clone中的版本
2、curl使用mac 平台中brew 安装了 7.33.0
3、编译的时候指定了新curl的安装目录
4、phpinfo中显示的版本好也是7.33.0
5、我在Php.ini中已经配置了yar.timeout=30
6、yar.debug=1也只能看到两条debug 消息
如果server是公网可访问的,那么如何保证安全性呢?目前我使用的办法是自己写token验证,请问生产环境下有没有更高的办法?谢谢!
主要想了解一下,现在走curl来和php交互,如果加入java/python在后端的支持(我看介绍上写着未来会支持),那么准备用哪一种方式来做?或者,能否用简单的代码表示一下,如果后端server不是php,那么server端会用哪种方式来开发?是用java/python写一个类库提供给server端封装request和response,还是用其他方式?
谢谢。
Yar_Concurrent_Client::call("http://rpcapi******", "getrelkey", array('生产毛坯', 'com'), 'callback', 'error_callback', array(YAR_OPT_TIMEOUT=>1));
Yar_Concurrent_Client::loop(); //send
getrelkey 函数中sleep 4s
发现设置的YAR_OPT_TIMEOUT 1s没起作用
$client = new Yar_Client("http://rpcapi**************");
$client->SetOpt(YAR_OPT_TIMEOUT, 1);
$result = $client->getrelkey(array('生产毛坯', 'com'));
var_dump($result);
这样设置的1s能看到效果
另外php.ini里面设置1000也能看到效果
系统max os
PHP Version 5.3.28
curl
cURL support enabled
yar
yar support enabled
Version 1.2.4-dev
Directive Local Value Master Value
yar.allow_persistent 0 0
yar.connect_timeout 1000 1000
yar.content_type application/octet-stream application/octet-stream
yar.debug 0 0
yar.expose_info On On
yar.packager php php
yar.timeout 5000 5000
yar.transport curl curl
盼回复
按照Http的标准,Content-Type = x-www-form-urlencoded,表示POST的body是key=hello&key2=hello2的形式。
Yar里设置了 Content-Type = x-www-form-urlencoded,但POST的body并不是 x-www-form-urlencoded 内容。
鸟哥你好。我用yar的时候为什么总是报这个错呢,我的例子是复制手册的,第一次用这个。不是很懂,然后我关了display_errors,就能返回结果,但是错误日志里面的还是记录了那个错误。然后我看到之前有个人问道了差不多的问题,你说话个curl版本就行了?求解答,谢谢鸟哥~
Warning: [Debug Yar_Client 5:52:34.649021]: 3928927588: call api 'add' at (r)'http://jessica.test/yar_server.php' with '2' parameters in /var/www/html/test/yar_client.php on line 6
Warning: [Debug Yar_Client 5:52:34.649174]: 3928927588: pack request by 'PHP', result len '83', content: 'a:3:{s:1:"i";i:3928927588;s:1:"m' in /var/www/html/test/yar_client.php on line 6
Fatal error: Uncaught exception 'Yar_Client_Protocol_Exception' with message 'malformed response header '
Warning: [Debug Y'' in /var/www/html/test/yar_client.php:6 Stack trace: #0 /var/www/html/test/yar_client.php(6): Yar_Client->__call('add', Array) #1 /var/www/html/test/yar_client.php(6): Yar_Client->add(1, 2) #2 {main} thrown in /var/www/html/test/yar_client.php on line 6
错误一直是这个。日志中记录的也是这个。不知道是不是和你之前解答一个人的那种情况一样。是curl的版本问题。
这个是curl信息
cURL support enabled
cURL Information 7.19.7
Age 3
Features
AsynchDNS No
Debug No
GSS-Negotiate Yes
IDN Yes
IPv6 Yes
Largefile Yes
NTLM Yes
SPNEGO No
SSL Yes
SSPI No
krb4 No
libz Yes
CharConv No
Protocols tftp, ftp, telnet, dict, ldap, ldaps, http, file, https, ftps, scp, sftp
Host x86_64-redhat-linux-gnu
SSL Version NSS/3.15.3
ZLib Version 1.2.3
libSSH Version libssh2/1.4.2
我是用yum安装的,不知道如何升级你说的那个版本。还有就是编译yar的时候提示要装libcurl和libcurl-devel,和那个有关系吗?谢谢鸟哥
用python写服务端时,框架自动把post的内容转换成了utf-8的,然后解析结果总是不对,把转换去掉,不做任何转换就可以了
在Mac上客户端报的错误是:
server responsed non-200 code '500'
error_log中的服务器端的错误是
PHP Fatal error: Yar_Server::handle(): in /Users/mac/work/yarTest/server.php on line 16
用的代码就是官网提供的例子,如下:
<?php
ini_set("display_errors", "Off");
class API {
/**
* the doc info will be generated automatically into service info page.
* @params
* @return
*/
public function doApi($parameter='', $option = "foo") {
return $parameter;
}
/**
* generated
* @return
*/
protected function client_can_not_see() {
}
}
$service = new Yar_Server(new API());
$service->handle();
调用代码
<?php
$x = new Yar_Client('http://target_server/test.php');
try {
$param = 'hello';
$ret = $x->doApi($param);
var_dump($ret);
} catch (Exception $e ) {
echo $e->getMessage();
}
Mac上测试了1.2.3和1.2.4
Linux上面只测试了1.2.3
PHP是homebrew-php的php56
不知道大家有没有遇到这样的问题
Ubuntu14.04上用的ppa:ondrej/php5-5.6的php。
php及php5-fpm版本信息
PHP 5.6.14-1+deb.sury.org~trusty+1 (fpm-fcgi)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
yar手动编译,使用过1.2.3, 1.2.4及commit baefc15424a3b01178b1dba65dc0e491b08da297的版本。
server:-----------------------------
Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::call("http://host/api/", "api", array("parameters"), "callback");
Yar_Concurrent_Client::loop(); //send
客户端一般都是写在框架里面,callback可以是本地对象的方法吗?
ON x86_64 evreything seems ok.
On i386, 1 failed test.
TEST 10/17 [tests/010.phpt]
========DIFF========
001+ Warning: [Debug Yar_Client 11:7:20.380463]: -496872129: call api 'normal' at (r)'http://localhost:8964/' with '1' parameters in /builddir/build/BUILD/php-pecl-yar-1.2.5/NTS/tests/010.php on line 8
001- Warning: [Debug Yar_Client %s]: %d: call api 'normal' at (r)'%s' with '1' parameters in %s010.php on line %d
003+ Warning: [Debug Yar_Client 11:7:20.380482]: -496872129: pack request by 'PHP', result len '86', content: 'a:3:{s:1:"i";i:-496872129;s:1:"m' in /builddir/build/BUILD/php-pecl-yar-1.2.5/NTS/tests/010.php on line 8
003- Warning: [Debug Yar_Client %s]: %d: pack request by 'PHP', result len '%d', content: 'a:3:{s:1:"i";i:%s' in %s010.php on line %d
005+ Warning: [Debug Yar_Client 11:7:20.380901]: -496872129: server response content packaged by 'PHP', len '65', content 'a:3:{s:1:"i";i:-496872129;s:1:"s' in /builddir/build/BUILD/php-pecl-yar-1.2.5/NTS/tests/010.php on line 8
005- Warning: [Debug Yar_Client %s]: %d: server response content packaged by 'PHP', len '%d', content 'a:3:{s:1:"i";i%s' in %s010.php on line %d
========DONE========
FAIL Check for yar debug [tests/010.phpt]
发现SAE的phpinfo中支持yar,信息如下:
yar support | enabled |
---|---|
Version | 1.2.3 |
Directive | Local Value | Master Value |
---|---|---|
yar.allow_persistent | 0 | 0 |
yar.connect_timeout | 1000 | 1000 |
yar.content_type | application/octet-stream | application/octet-stream |
yar.debug | Off | Off |
yar.expose_info | no value | no value |
yar.packager | php | php |
yar.timeout | 5000 | 5000 |
yar.transport | curl | curl |
于是乎按照说明写了一段代码进行测试,
<?php
class API {
/**
* the doc info will be generated automatically into service info page.
* @params
* @return
*/
public function some_method($parameter, $option = "foo") {
}
protected function client_can_not_see() {
}
}
$service = new Yar_Server(new API());
$service->handle();
?>
结果报如下错误:
Fatal error: Uncaught exception 'Yar_Server_Exception' with message 'server info is not allowed to access' in /data1/www/htdocs/407/bonjourchen/1/yar.php:17 Stack trace: #0 /data1/www/htdocs/407/bonjourchen/1/yar.php(17): Yar_Server->handle() #1 {main} thrown in yar.php on line 17
估计是SAE的权限不允许,server info is not allowed to access,但是没办法改动php.ini,请问有什么办法么?
能否支持client请求用的json时服务器端也返回json的序列化,否则如果实现例如java的客户端就很难解析默认的php序列化
鸟哥 你好
我想做一个rpc接口 用yaf+yar实现
class IndexController Extends Yaf_Controller_Abstract
{
private function init() {
$service = new Yar_Server(new static());
$service->handle();
}
public function loginAction() {//默认Action
}
}
但是返回错误信息如下
Warning: Yaf_Controller_Abstract::__construct() expects at least 3 parameters, 0 given in D:\wwwroot\FrameWork\yaf-yar\app\application\modules\User\controllers\Index.php on line 14
想问问鸟哥有什么好方法推荐没
发现了一个问题,不知道如何解决,看能不能提供一下解决思路。
在mac下用brew install 装了php 5.6 beta 1,然后brew 装了yar 1.2.2 。
采用 http://www.php.net/manual/zh/yar.examples.php 范例写了个简单程序。
但是发现client 请求 server 报 500
server 得 error log是
/var/test/wbapi_server_test.php on line 38
[09-May-2014 21:50:03 Asia/Shanghai] PHP Fatal error: Yar_Server::handle(): unsupported packager ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ]��) in /var/www/test/wbapi_server_test.php on line 38
[09-May-2014 21:50:03 Asia/Shanghai] PHP Fatal error: Uncaught exception 'Yar_Client_Transport_Exception' with message 'server responsed non-200 code '500'' in /var/www/test/local.php:7
Stack trace:
#0 /var/www/test/local.php(7): Yar_Client->__call('add', Array)
#1 /var/www/test/local.php(7): Yar_Client->add(2, 2)
#2 {main}
thrown in /var/www/test/local.php on line 7
同样得程序在ubuntu server 上是没有问题的。而且我用本地的yar client 请求 ubuntu得yar server 也是没问题的。尝试把yar 升级到1.2.3 还是有同样的问题。
不知道如何再往下解决了,所以来求助,帮忙看一下,能不能提供一下解决思路,以下是 acces log 和error log,并且开启了yar debug模式
127.0.0.1 - - [09/May/2014:22:06:40 +0800] "POST /test/wbapi_server_test.php HTTP/1.1" 500 5 "-" "PHP Yar Rpc-1.2.3"
127.0.0.1 - - [09/May/2014:22:06:40 +0800] "GET /test/local.php HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36"
[09-May-2014 22:06:40 Asia/Shanghai] PHP Warning: [Debug Yar_Client 22:6:40.243932]: 4211938678: call api 'add' at (r)'http://wbtest.com/test/wbapi_server_test.php' with '2' parameters in /var/www/test/local.php on line 7
[09-May-2014 22:06:40 Asia/Shanghai] PHP Warning: [Debug Yar_Client 22:6:40.245076]: 4211938678: pack request by 'JSON', result len '44', content: '{"i":4211938678,"m":"add","p":[2' in /var/www/test/local.php on line 7
[09-May-2014 22:06:40 Asia/Shanghai] PHP Warning: [Debug Yar_Server 22:6:40.292866]: 4211938678: accpect rpc request form '' in /var/www/test/wbapi_server_test.php on line 38
[09-May-2014 22:06:40 Asia/Shanghai] PHP Fatal error: Yar_Server::handle(): unsupported packager ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ]��) in /var/www/test/wbapi_server_test.php on line 38
[09-May-2014 22:06:40 Asia/Shanghai] PHP Fatal error: Uncaught exception 'Yar_Client_Transport_Exception' with message 'server responsed non-200 code '500'' in /var/www/test/local.php:7
Stack trace:
#0 /var/www/test/local.php(7): Yar_Client->__call('add', Array)
#1 /var/www/test/local.php(7): Yar_Client->add(2, 2)
#2 {main}
thrown in /var/www/test/local.php on line 7
以下是扩展信息
yar
yar support enabled
Version 1.2.3
Directive Local Value Master Value
yar.allow_persistent 0 0
yar.connect_timeout 30000 30000
yar.content_type application/octet-stream application/octet-stream
yar.debug 1 1
yar.expose_info 1 1
yar.packager json json
yar.timeout 30000 30000
yar.transport curl curl
Yar_Concurrent_Client::call($url, 'lists');
Yar_Concurrent_Client::call($url, 'lists');
Yar_Concurrent_Client::loop();
Yar_Concurrent_Client::call($url, 'lists');
Yar_Concurrent_Client::call($url, 'lists');
Yar_Concurrent_Client::loop();
第一次loop时会发起2次请求,第二次loop时会发起4次请求
client并行处理的时候,如果有一个请求超时或者连接不上,会callback吗?
如该示例:http://cn2.php.net/manual/zh/yar.examples.php
server
<?php
class Operator {
/**
* Add two operands
* @param interge
* @return interge
*/
public function add($a, $b) {
return $this->_add($a, $b);
}
public function __call($method, $args)
{
switch (count($args))
{
case 0:
//do something
case 1:
//do something
default:
//do something
}
}
}
$server = new Yar_Server(new Operator());
$server->handle();
?>
这样客户端就可以这样:
client
<?php
$client = new yar_client("http://example.com/operator.php");
/* call directly */
var_dump($client->someundefinedmethod(1, 2));
?>
单独设置的errorCallback和loop的errorCallback都没有调用 , loop的回调有调用,参数值都是null
BUG现象同:#15
环境:
windows7
php5.6.10/5.6.11 (nts x86)
nginx 1.9.2
cURL Information 7.42.1
msgpack 0.5.6
yar 1.2.3/1.2.4
错误为:
Yar_Client_Transport_Exception’ with message ‘curl exec failed ‘Timeout was reached’
配置了php.ini中yar.debug=1,可以看到:
Warning: [Debug Yar_Client 18:39:21.422666]: 575645727: call api ‘api’ at (r)’http://zftest/yar/service/TestServiceProvider.php‘ with ’1′ parameters in E:\workspace\test_project\unit_test\src\main\yar\client\TestConsumer.php on line 31
Warning: [Debug Yar_Client 18:39:21.422666]: 575645727: pack request by ‘PHP’, result len ’80′, content: ‘a:3:{s:1:”i”;i:575645727;s:1:”m”‘ in E:\workspace\test_project\unit_test\src\main\yar\client\TestConsumer.php on line 31
跟了一下nginx的access日志:
POST /yar/service/TestServiceProvider.php HTTP/1.1 499 0 4.992
第一部分,post请求,
第二部分:请求地址与协议,
第三部分:返回的http状态码
第四部分:消息体长度
第五部分:请求时长
目前在项目中用到,本地开发请求了测试机的yar,网络延时挺多的,不知道能否直接提供一个dll
源码如下:
function callback($retval, $callinfo) {
var_dump($retval);
}
function error_callback($type, $error, $callinfo) {
error_log($error);
}
Yar_Concurrent_Client::call("http://192.168.3.96/yar.php", "run", array("test1"), "callback", "error_callback", array(YAR_OPT_TIMEOUT => 30000, YAR_OPT_CONNECT_TIMEOUT => 30000));
Yar_Concurrent_Client::call("http://192.168.3.96/yar.php", "run1", array("test2"), "callback", "error_callback", array(YAR_OPT_TIMEOUT => 30000, YAR_OPT_CONNECT_TIMEOUT => 30000));
Yar_Concurrent_Client::call("http://192.168.3.96/yar.php", "run2", array("test3"), "callback", "error_callback", array(YAR_OPT_TIMEOUT => 30000, YAR_OPT_CONNECT_TIMEOUT => 30000));
Yar_Concurrent_Client::loop('callback', 'error_callback');
执行的时候,提示超时现象,这个是什么原因呢?loop有没有设置可以超时时间的地方呢?
运行环境:
ubuntu-server:10.04
PHP: 5.3.2
cURL:7.33.0
PHP Warning: Yar_Concurrent_Client::loop(): can not get fd from curl instance
理论上并发应该是2个可以返回合理
Yar_Server_Exception in Client.php line 177:
No connecting found while writing data to socket.
请问这个是什么错误
root@4c23add1346d:/home/yar-1.2.4# pecl install yar-1.2.4
pecl/yar can optionally use PHP extension "msgpack"
downloading yar-1.2.4.tgz ...
Starting to download yar-1.2.4.tgz (38,355 bytes)
..........done: 38,355 bytes
25 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Enable Msgpack Supports [no] :
building in /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4
running: /tmp/pear/temp/yar/configure --enable-msgpack=no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.13.5 (ok)
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable yar support... yes, shared
checking for curl protocol support... yes, shared
checking for msgpack packager support... no
checking for cURL in default path... found in /usr
checking for epoll... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar.c -o yar.lo
mkdir .libs
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar.c -fPIC -DPIC -o .libs/yar.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_server.c -o yar_server.lo
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_server.c -fPIC -DPIC -o .libs/yar_server.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_client.c -o yar_client.lo
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_client.c -fPIC -DPIC -o .libs/yar_client.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_request.c -o yar_request.lo
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_request.c -fPIC -DPIC -o .libs/yar_request.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_response.c -o yar_response.lo
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_response.c -fPIC -DPIC -o .libs/yar_response.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_exception.c -o yar_exception.lo
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_exception.c -fPIC -DPIC -o .libs/yar_exception.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_packager.c -o yar_packager.lo
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_packager.c -fPIC -DPIC -o .libs/yar_packager.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_protocol.c -o yar_protocol.lo
cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/yar_protocol.c -fPIC -DPIC -o .libs/yar_protocol.o
/bin/bash /tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/yar -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/include -I/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/main -I/tmp/pear/temp/yar -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/yar/packagers/php.c -o packagers/php.lo
/tmp/pear/temp/pear-build-defaultuser1YQf3u/yar-1.2.4/libtool: line 1283: packagers/php.loT: No such file or directory
mkdir packagers/.libs
mkdir: cannot create directory 'packagers/.libs': No such file or directory
Makefile:187: recipe for target 'packagers/php.lo' failed
make: *** [packagers/php.lo] Error 1
ERROR: `make' failed
昨天由于自己疏忽,把server端通过nginx强制了https(如果是http就301到https),之后也没测试……今天发现一直返回:server responsed non-200 code '301',才想到,虽然改了代码可以搞定,但是也希望知道YAR是否考虑支持跳转呢?
Windows下调用yar也出现 can not get fd from curl instance
Yar_Concurrent_Client::call($conf['yar_url'], "api_call", array('province_baiducity','read',array('1')),
"callback", "error_callback", array(YAR_OPT_PACKAGER => "json"));
Yar_Concurrent_Client::call($conf['yar_url'], "api_call", array("province_lessons",'read',array('00174','173')),
"callback", "error_callback", array(YAR_OPT_TIMEOUT=>5000));
Yar_Concurrent_Client::loop("callback", "error_callback"); //send the requests,*/
Yar_Concurrent_Client::loop("callback", "error_callback");
callback 所获得参数均为null
error_callback 根本没有调用
( ! ) Warning: [Debug Yar_Client 9:48:56.841297]: -293666116: call api 'api_call' at (r)'http://127.0.0.1/wxservice/' with '1' parameters in D:\MiniServer\www\htdocs\wxservice\test.php on line 22
Call Stack
1 0.0006 133864 {main}( ) ..\test.php:0
2 0.0013 147768 api_call ( ) ..\test.php:22
( ! ) Warning: [Debug Yar_Client 9:48:56.841940]: -293666116: pack request by 'JSON', result len '57', content: '{"i":-293666116,"m":"api_call","' in D:\MiniServer\www\htdocs\wxservice\test.php on line 22
Call Stack
1 0.0006 133864 {main}( ) ..\test.php:0
2 0.0013 147768 api_call ( ) ..\test.php:22
exception 'Yar_Client_Protocol_Exception' with message 'malformed response header '
Stack trace:
#0 D:\MiniServer\www\htdocs\wxservice\test.php(22): Yar_Client->__call('api_call', Array)
#1 D:\MiniServer\www\htdocs\wxservice\test.php(22): Yar_Client->api_call('parameter')
#2 {main}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.