From 62eae2504492d2004c1c427cd4f6afba705d204d Mon Sep 17 00:00:00 2001 From: zhian song Date: Sat, 11 Nov 2017 15:47:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sky-php7ext/README.md | 39 +++++++++++++++++++++------------------ sky-php7ext/skywalking.c | 4 +--- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/sky-php7ext/README.md b/sky-php7ext/README.md index b813786..3ad96ce 100644 --- a/sky-php7ext/README.md +++ b/sky-php7ext/README.md @@ -11,41 +11,44 @@ ### Installation -To install PHP SkyWalking Class, simply: - - +To install PHP SkyWalking extend, simply: +copy ini to php.ini +commands:: + + git clone https://github.com/SkywalkingContrib/skywalking-php-sdk.git + cd skywalking-php-sdk/sky-php7ext + phpize + .configure + make -j [number_of_processor_cores] # eg. make -j 4 + make install ### Requirements -PHP Curl Class works with PHP 5.0,5.3, 5.4, 5.5, 5.6, 7.0, and HHVM. +the current phpext works with PHP 7.0-7.9.99 。 +this extension references something external, use with: pphcurl、phpjson and phpstandard + +### Documentation +- https://github.com/OpenSkywalking/skywalking/wiki ### Quick Start and Examples - + set php.ini skywalking.auto_open = On OR skywalking.auto_open = OFF As below: + // must put these code at the beginning !!! - // that would auto register shutdown function !!! - - include_once ("./SkyWalking.php");// or use composer - - //LOG_PATH is skywalking's logfile path - SkyWalking::getInstance("mapi")->setLogPath(LOG_PATH)->setSamplingRate(5); .... .... - + + $ch = curl_init(); curl_setopt($ch); - .... - .... - - SkyWalking::getInstance()->startSpanOfCurl("www.dangdang.com", $headers); - + SkyWalking::getInstance()->startSpanOfCurl("www.api.com", $headers); .... .... curl_setopt($ch); $rs = curl_exec($ch); - SkyWalking::getInstance()->endSpanOfcurl($curl); + SkyWalking::getInstance()->endSpanOfcurl($ch); .... .... \ No newline at end of file diff --git a/sky-php7ext/skywalking.c b/sky-php7ext/skywalking.c index c8273e3..d085a23 100644 --- a/sky-php7ext/skywalking.c +++ b/sky-php7ext/skywalking.c @@ -925,8 +925,6 @@ static void _init(const char *appCode, zval *this_ptr){ add_assoc_null(&allparts_property, SKYWALKING_ENDTIME); SKY_ADD_ASSOC_ZVAL(&allparts_property, SKYWALKING_FATHER_NODE_DATA); SKY_ADD_ASSOC_ZVAL(&allparts_property, SKYWALKING_SPANS_NODE_DATA); - //add_assoc_zval(&allparts_property, SKYWALKING_FATHER_NODE_DATA, &null_array); - //add_assoc_zval(&allparts_property, SKYWALKING_SPANS_NODE_DATA, &null_array); add_assoc_null(&allparts_property, SKYWALKING_APP_CODE); add_assoc_null(&allparts_property, SKYWALKING_DISTRIBUTED_TRACEIDS); zend_update_property(skywalking_ce_entry, this_ptr, ZEND_STRL("_allPartsNodesStruct"), &allparts_property); @@ -975,7 +973,7 @@ static void _init(const char *appCode, zval *this_ptr){ zend_update_property_string(skywalking_ce_entry, this_ptr, ZEND_STRL("_appCode"), appCode); - //对节点数据进行结构初始化 + //对节点数据进行结构初始化 zval *all_parts_nodes_struct, all_node_data; all_parts_nodes_struct = zend_read_property(skywalking_ce_entry, this_ptr, ZEND_STRL("_allPartsNodesStruct"), 1, NULL); array_init(&all_node_data); -- GitLab