Repository: pinpoint-apm/pinpoint-c-agent (language: python)

Issue:
I need some help
> I need some help ...

##############PINPOINT###########################
require_once __DIR__.'/../vendor/autoload.php';
define('APPLICATION_NAME','php');
define('APPLICATION_ID','2');
define('AOP_CACHE_DIR',__DIR__.'/../Cache/');
define('PLUGINS_DIR',__DIR__.'/../Plugins/');
define('PINPOINT_USE_CACHE','YES');
require_once __DIR__.'/../vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php';
#################################################

collector.log

[2024-04-15 13:56:50.024840042]  INFO client:10.0.0.167:35716 is online
[2024-04-15 13:56:50.024928028]  INFO send handshake msg:{"appid":"no","appname":"no","time":"1713141240"}

 why "appid":"no","appname":"no ?
I need some help
> I need some help ...

##############PINPOINT###########################
require_once __DIR__.'/../vendor/autoload.php';
define('APPLICATION_NAME','php');
define('APPLICATION_ID','2');
define('AOP_CACHE_DIR',__DIR__.'/../Cache/');
define('PLUGINS_DIR',__DIR__.'/../Plugins/');
define('PINPOINT_USE_CACHE','YES');
require_once __DIR__.'/../vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php';
#################################################

collector.log

[2024-04-15 13:56:50.024840042]  INFO client:10.0.0.167:35716 is online
[2024-04-15 13:56:50.024928028]  INFO send handshake msg:{"appid":"no","appname":"no","time":"1713141240"}

 why "appid":"no","appname":"no ?


Discussion / hints:
> why "appid":"no","appname":"no ?

it's an old setting, deprecated now. (agent information can be set at collector-agent side)
how setting?
Please tell me how to set up the collector-agent.
### collector-agent 

https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/DOC/collector-agent/readme.md

###  php agent

```
define('APPLICATION_NAME','php');
define('APPLICATION_ID','2');
```

what?
.bash_profile

export PP_COLLECTOR_AGENT_SPAN_IP=127.0.0.1
export PP_COLLECTOR_AGENT_SPAN_PORT=9993
export PP_COLLECTOR_AGENT_AGENT_IP=127.0.0.1
export PP_COLLECTOR_AGENT_AGENT_PORT=9991
export PP_COLLECTOR_AGENT_STAT_IP=127.0.0.1
export PP_COLLECTOR_AGENT_STAT_PORT=9992
export PP_COLLECTOR_AGENT_ISDOCKER=false
export PP_LOG_DIR=/app/pinpoint/logs
export PP_Log_Level=INFO
export PP_ADDRESS=0.0.0.0@9999

php.ini

[pinpoint_php]
extension = pinpoint_php.so
pinpoint_php.CollectorHost = tcp:211.45.120.7:9999
pinpoint_php.SendSpanTimeOutMs = 0
pinpoint_php.TraceLimit = -1
pinpoint_php.DebugReport = true

[error_log]
error_reporting = E_ALL
#log_errors = On
error_log = /var/log/php/php-error.log

common.php

##############PINPOINT###########################
require_once __DIR__.'/../vendor/autoload.php';
define('APPLICATION_NAME','GNB');
define('APPLICATION_ID','2');
define('AOP_CACHE_DIR',__DIR__.'/../Cache/');
define('PLUGINS_DIR',__DIR__.'/../Plugins/');
define('PINPOINT_USE_CACHE','YES');
require_once __DIR__.'/../vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php';
#################################################

Is it different?

It is not registered on the web and cannot be connected to pinpoint-collector.
Please attach the output of php agent. 

https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/testapps/PHP/php.ini

Does your pinpoint-collector locate at  "PP_COLLECTOR_AGENT_SPAN_IP=127.0.0.1" ?

It is installed locally.
collector-agent  / pinpoint-collector is installed locally.
> 
> collector.log
> 
> [2024-04-15 13:56:50.024840042] INFO client:10.0.0.167:35716 is online
> [2024-04-15 13:56:50.024928028] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713141240"}
> 
> why "appid":"no","appname":"no ?




> Please tell me how to set up the collector-agent.


it looks collector-agent woks fine. 
collector.log

[2024-04-15 17:10:43.110591367]  INFO client:127.0.0.1:50806 is online
[2024-04-15 17:10:43.110772605]  INFO send handshake msg:{"appid":"no","appname":"no","time":"1713165831"}
[2024-04-15 17:10:43.111114644]  WARN no FT
[2024-04-15 17:10:43.111140757]  WARN dispather packet with an exception: no FT
[2024-04-15 17:10:43.111154559]  WARN parseInComePacket catches error:no FT,client:127.0.0.1:50806
[2024-04-15 17:10:43.11116987]  INFO connection:127.0.0.1:50806 is shutdown

why isn't registered on the web?
Enable  "log_errors= On " and share us the logging of your php application.
https://github.com/pinpoint-apm/pinpoint-c-agent/blob/1bdfc706adc9cd44e93a9e6b08bd32fe1c6f685b/testapps/PHP/php.ini#L9
no logging
collector.log

[2024-04-15 17:51:14.645184858]  INFO client:10.0.0.167:60632 is online
[2024-04-15 17:51:14.645371276]  INFO send handshake msg:{"appid":"no","appname":"no","time":"1713171031"}
[2024-04-15 17:51:14.64558775] DEBUG size: 275  packetType: 1 body:{":E":252,":FT":1500,":S":1713171074392,"appid":"php-1","appname":"GNB","client":"192.168.10.20","clues":["46:200"],"name":"PHP Request: fpm-fcgi","server":"10.0.0.167","sid":"1718730853","stp":"1500","tid":"php-1^1713171066709^0","uri":"/gnuboard/bbs/board.php?bo_table=qa"}
[2024-04-15 17:51:14.645708234]  WARN no FT
[2024-04-15 17:51:14.645762668]  WARN dispather packet with an exception: no FT
[2024-04-15 17:51:14.645790138]  WARN parseInComePacket catches error:no FT,client:10.0.0.167:60632
[2024-04-15 17:51:14.645831342]  INFO connection:10.0.0.167:60632 is shutdown
> collector.log
> 
> [2024-04-15 17:51:14.645184858] INFO client:10.0.0.167:60632 is online [2024-04-15 17:51:14.645371276] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713171031"} [2024-04-15 17:51:14.64558775] DEBUG size: 275 packetType: 1 body:{":E":252,":FT":1500,":S":1713171074392,"appid":"php-1","appname":"GNB","client":"192.168.10.20","clues":["46:200"],"name":"PHP Request: fpm-fcgi","server":"10.0.0.167","sid":"1718730853","stp":"1500","tid":"php-1^1713171066709^0","uri":"/gnuboard/bbs/board.php?bo_table=qa"} [2024-04-15 17:51:14.645708234] WARN no FT [2024-04-15 17:51:14.645762668] WARN dispather packet with an exception: no FT [2024-04-15 17:51:14.645790138] WARN parseInComePacket catches error:no FT,client:10.0.0.167:60632 [2024-04-15 17:51:14.645831342] INFO connection:10.0.0.167:60632 is shutdown

Try the latest collector-agent .  
docker pull ghcr.io/pinpoint-apm/pinpoint-c-agent/collector-agent:0.5.0
#define PHP_PINPOINT_PHP_VERSION "0.2.1"


please update the collector-agent

don't go build

[pin@Zenius collector-agent]$ go build
common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it:
        go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1
make error

[pin@Zenius collector-agent]$ make
protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto  --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
google/protobuf/wrappers.proto: File not found.
v1/Annotation.proto: Import "google/protobuf/wrappers.proto" was not found or had errors.
v1/Annotation.proto:15:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:20:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:21:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:26:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:27:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:36:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:47:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:48:5: "google.protobuf.StringValue" is not defined.
make: *** [makefile:8: protoc] Error 1
you missed the submodule

>  git clone --recurse-submodules https://github.com/pinpoint-apm/pinpoint-c-agent.git 
fail

![사용자 지정 1](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/2e30dfc5-2e70-4cbe-89d0-d4f628ea42fa)

please check the dockerfile of collector-agent
https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/collector-agent/Dockerfile

Script for compile collector-agent
```
...
apk add make protobuf-dev
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
...
```
what's mean?

i'm not use docker.
[root@Zenius collector-agent]# go build
common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it:
        go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1

![1](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/a16d8544-9deb-4465-bb20-be9bc16b276f)


please check this https://github.com/pinpoint-apm/pinpoint-c-agent/issues/596#issuecomment-2058263607
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/0feb0f33-fdf2-409c-9389-26f06deba8a4)

Dockerfile?

apk?

[root@Zenius collector-agent]# apk add --no-cache make protobuf-dev
bash: apk: command not found...

????
I want to install it as server, not as docker

CentOS Linux release 8.5.2111
I tried by docker of centos 8 ,while it's EOL. 

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/27064129/3f827db0-9dc6-4ef2-ba15-446a12149c3f)

Here is checklist:

- [ ]  go version (1.18)
- [ ]  protoc version (3.6.1)

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/27064129/52683cff-998e-45da-bc68-86c0ad1badac)



[root@Zenius pin]# go version
go version go1.22.0 linux/amd64
[root@Zenius pin]# protoc --version
libprotoc 3.5.0
how about "go install" ? 

(venv) pinpoint@pinpoint:/workspace/collector-agent$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go: downloading google.golang.org/protobuf v1.33.0
go: downloading google.golang.org/grpc v1.63.2
[root@Zenius app]# go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go: downloading google.golang.org/protobuf v1.33.0
go: downloading google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
go: downloading google.golang.org/grpc v1.63.2
go: downloading google.golang.org/protobuf v1.28.1
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/8e4054cf-ec36-4357-9edd-3062ebc3f4c2)

i think
this link is problem.

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/9190059d-79ac-410d-b336-3f3f2109290d)

no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1

hmm, how about this command ? 

protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto  --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
[root@Zenius collector-agent]# protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
google/protobuf/wrappers.proto: File not found.
v1/Annotation.proto: Import "google/protobuf/wrappers.proto" was not found or had errors.
v1/Annotation.proto:15:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:20:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:21:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:26:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:27:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:36:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:47:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:48:5: "google.protobuf.StringValue" is not defined.
try https://gist.github.com/olivoil/a2e0e4f3427db8b6ef4a6374f9c4cb32

> backup the old one, if you need
[root@Zenius collector-agent]# make
protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto  --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
protoc-gen-go: program not found or is not executable
--go_out: protoc-gen-go: Plugin failed with status code 1.
make: *** [makefile:8: protoc] Error 1
[root@Zenius collector-agent]# go build
common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it:
        go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1
[root@Zenius collector-agent]# protoc --version
libprotoc 3.5.0
[root@Zenius collector-agent]#
.bash_profile add

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN

and compile success
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/d55c5d61-e20d-4436-9c1d-890293e98231)


![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/1b5359f4-4203-428a-9ddb-cec556d5b2ee)

DB information cannot be retrieved.
which php framework you used ?
i'm not used framework.
by the way, which mysql client used?  just pdo ? 

> php-agent does not support c-level plugins yet, if used yii, `\yii\db\Connection` is `JoinPoint`
[root@Zenius lib]# pwd
/app/mysql/lib
[root@Zenius lib]# ls
libmariadbclient.a  libmariadb.so  libmariadb.so.3  libmysqlclient.a  libmysqlclient_r.a  libmysqlclient_r.so  libmysqlclient.so  libmysqlservices.a  pkgconfig  plugin
why not call tree?
my project 
[html.zip](https://github.com/pinpoint-apm/pinpoint-c-agent/files/15019174/html.zip)

As c-level function does not support yet, I will re-implement all plugins to support c-level in future.  

> sorry 


I don't know how to create a custom plugin.
I'm just an operator, not a developer.
Can you tell me how to set it up?
@killen9  

I find your project does not follow the `psr-4`, that means you can't use this version, even the custom plugin.

> Ref 

- psr-4 https://www.php-fig.org/psr/psr-4/
I tag this issue into next major version.
In addition to db information, I also want to display call-tree (trace) information and mem information.
I would appreciate your help.
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/0aa0b0f6-3f72-496b-8b2b-5f54aef2ba32)

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/3464b1b6-5191-4ad9-acf2-16c6b032c431)

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/5ce682a6-3563-4606-864d-1affe66d1d53)


@killen9  

you can use `Pinpoint\Plugins\Sys\PDO` as your PDO plugins on php. 

Supported list:  
https://github.com/pinpoint-apm/pinpoint-php-aop/tree/dev/lib/Pinpoint/Plugins/Sys

How should I apply it?
hmm, I find your project use `mysql_connect` , it's not support any more. 

try use PDO, or mysqli

## Ref

- mysql_connect https://www.php.net/manual/en/function.mysql-connect.php
I don't know much about php.
I would appreciate it if you could tell me how to apply it to my project.
OK, 

1. remove deprecated style for handle mysql, use [PDO_MYSQL](https://www.php.net/manual/en/ref.pdo-mysql.php) or [msyqli](https://www.php.net/manual/en/book.mysqli.php) instead.
2. After `1` is done, use pinpoint plugins class to replace PDO_MYSQL or msyqli
  - PDO -> Pinpoint\Plugins\Sys\PDO\PDO
  - mysqli=Pinpoint\Plugins\Sys\mysqli\mysqli

> this older file may help you https://github.com/pinpoint-apm/pinpoint-c-agent/blob/v0.4.10/testapps/PHP/Plugins/setting.ini
I deleted the DB and installed mariadb 10.11 using yum.

However, DB information and trace still do not appear.
Which db extension you used ?  PDO or mysqli ?

I will post an example for you.
> why "appid":"no","appname":"no ?

it's an old setting, deprecated now. (agent information can be set at collector-agent side)
how setting?
Please tell me how to set up the collector-agent.
### collector-agent 

https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/DOC/collector-agent/readme.md

###  php agent

```
define('APPLICATION_NAME','php');
define('APPLICATION_ID','2');
```

what?
.bash_profile

export PP_COLLECTOR_AGENT_SPAN_IP=127.0.0.1
export PP_COLLECTOR_AGENT_SPAN_PORT=9993
export PP_COLLECTOR_AGENT_AGENT_IP=127.0.0.1
export PP_COLLECTOR_AGENT_AGENT_PORT=9991
export PP_COLLECTOR_AGENT_STAT_IP=127.0.0.1
export PP_COLLECTOR_AGENT_STAT_PORT=9992
export PP_COLLECTOR_AGENT_ISDOCKER=false
export PP_LOG_DIR=/app/pinpoint/logs
export PP_Log_Level=INFO
export PP_ADDRESS=0.0.0.0@9999

php.ini

[pinpoint_php]
extension = pinpoint_php.so
pinpoint_php.CollectorHost = tcp:211.45.120.7:9999
pinpoint_php.SendSpanTimeOutMs = 0
pinpoint_php.TraceLimit = -1
pinpoint_php.DebugReport = true

[error_log]
error_reporting = E_ALL
#log_errors = On
error_log = /var/log/php/php-error.log

common.php

##############PINPOINT###########################
require_once __DIR__.'/../vendor/autoload.php';
define('APPLICATION_NAME','GNB');
define('APPLICATION_ID','2');
define('AOP_CACHE_DIR',__DIR__.'/../Cache/');
define('PLUGINS_DIR',__DIR__.'/../Plugins/');
define('PINPOINT_USE_CACHE','YES');
require_once __DIR__.'/../vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php';
#################################################

Is it different?

It is not registered on the web and cannot be connected to pinpoint-collector.
Please attach the output of php agent. 

https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/testapps/PHP/php.ini

Does your pinpoint-collector locate at  "PP_COLLECTOR_AGENT_SPAN_IP=127.0.0.1" ?

It is installed locally.
collector-agent  / pinpoint-collector is installed locally.
> 
> collector.log
> 
> [2024-04-15 13:56:50.024840042] INFO client:10.0.0.167:35716 is online
> [2024-04-15 13:56:50.024928028] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713141240"}
> 
> why "appid":"no","appname":"no ?




> Please tell me how to set up the collector-agent.


it looks collector-agent woks fine. 
collector.log

[2024-04-15 17:10:43.110591367]  INFO client:127.0.0.1:50806 is online
[2024-04-15 17:10:43.110772605]  INFO send handshake msg:{"appid":"no","appname":"no","time":"1713165831"}
[2024-04-15 17:10:43.111114644]  WARN no FT
[2024-04-15 17:10:43.111140757]  WARN dispather packet with an exception: no FT
[2024-04-15 17:10:43.111154559]  WARN parseInComePacket catches error:no FT,client:127.0.0.1:50806
[2024-04-15 17:10:43.11116987]  INFO connection:127.0.0.1:50806 is shutdown

why isn't registered on the web?
Enable  "log_errors= On " and share us the logging of your php application.
https://github.com/pinpoint-apm/pinpoint-c-agent/blob/1bdfc706adc9cd44e93a9e6b08bd32fe1c6f685b/testapps/PHP/php.ini#L9
no logging
collector.log

[2024-04-15 17:51:14.645184858]  INFO client:10.0.0.167:60632 is online
[2024-04-15 17:51:14.645371276]  INFO send handshake msg:{"appid":"no","appname":"no","time":"1713171031"}
[2024-04-15 17:51:14.64558775] DEBUG size: 275  packetType: 1 body:{":E":252,":FT":1500,":S":1713171074392,"appid":"php-1","appname":"GNB","client":"192.168.10.20","clues":["46:200"],"name":"PHP Request: fpm-fcgi","server":"10.0.0.167","sid":"1718730853","stp":"1500","tid":"php-1^1713171066709^0","uri":"/gnuboard/bbs/board.php?bo_table=qa"}
[2024-04-15 17:51:14.645708234]  WARN no FT
[2024-04-15 17:51:14.645762668]  WARN dispather packet with an exception: no FT
[2024-04-15 17:51:14.645790138]  WARN parseInComePacket catches error:no FT,client:10.0.0.167:60632
[2024-04-15 17:51:14.645831342]  INFO connection:10.0.0.167:60632 is shutdown
> collector.log
> 
> [2024-04-15 17:51:14.645184858] INFO client:10.0.0.167:60632 is online [2024-04-15 17:51:14.645371276] INFO send handshake msg:{"appid":"no","appname":"no","time":"1713171031"} [2024-04-15 17:51:14.64558775] DEBUG size: 275 packetType: 1 body:{":E":252,":FT":1500,":S":1713171074392,"appid":"php-1","appname":"GNB","client":"192.168.10.20","clues":["46:200"],"name":"PHP Request: fpm-fcgi","server":"10.0.0.167","sid":"1718730853","stp":"1500","tid":"php-1^1713171066709^0","uri":"/gnuboard/bbs/board.php?bo_table=qa"} [2024-04-15 17:51:14.645708234] WARN no FT [2024-04-15 17:51:14.645762668] WARN dispather packet with an exception: no FT [2024-04-15 17:51:14.645790138] WARN parseInComePacket catches error:no FT,client:10.0.0.167:60632 [2024-04-15 17:51:14.645831342] INFO connection:10.0.0.167:60632 is shutdown

Try the latest collector-agent .  
docker pull ghcr.io/pinpoint-apm/pinpoint-c-agent/collector-agent:0.5.0
#define PHP_PINPOINT_PHP_VERSION "0.2.1"


please update the collector-agent

don't go build

[pin@Zenius collector-agent]$ go build
common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it:
        go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1
make error

[pin@Zenius collector-agent]$ make
protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto  --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
google/protobuf/wrappers.proto: File not found.
v1/Annotation.proto: Import "google/protobuf/wrappers.proto" was not found or had errors.
v1/Annotation.proto:15:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:20:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:21:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:26:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:27:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:36:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:47:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:48:5: "google.protobuf.StringValue" is not defined.
make: *** [makefile:8: protoc] Error 1
you missed the submodule

>  git clone --recurse-submodules https://github.com/pinpoint-apm/pinpoint-c-agent.git 
fail

![사용자 지정 1](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/2e30dfc5-2e70-4cbe-89d0-d4f628ea42fa)

please check the dockerfile of collector-agent
https://github.com/pinpoint-apm/pinpoint-c-agent/blob/dev/collector-agent/Dockerfile

Script for compile collector-agent
```
...
apk add make protobuf-dev
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
...
```
what's mean?

i'm not use docker.
[root@Zenius collector-agent]# go build
common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it:
        go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1

![1](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/a16d8544-9deb-4465-bb20-be9bc16b276f)


please check this https://github.com/pinpoint-apm/pinpoint-c-agent/issues/596#issuecomment-2058263607
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/0feb0f33-fdf2-409c-9389-26f06deba8a4)

Dockerfile?

apk?

[root@Zenius collector-agent]# apk add --no-cache make protobuf-dev
bash: apk: command not found...

????
I want to install it as server, not as docker

CentOS Linux release 8.5.2111
I tried by docker of centos 8 ,while it's EOL. 

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/27064129/3f827db0-9dc6-4ef2-ba15-446a12149c3f)

Here is checklist:

- [ ]  go version (1.18)
- [ ]  protoc version (3.6.1)

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/27064129/52683cff-998e-45da-bc68-86c0ad1badac)



[root@Zenius pin]# go version
go version go1.22.0 linux/amd64
[root@Zenius pin]# protoc --version
libprotoc 3.5.0
how about "go install" ? 

(venv) pinpoint@pinpoint:/workspace/collector-agent$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go: downloading google.golang.org/protobuf v1.33.0
go: downloading google.golang.org/grpc v1.63.2
[root@Zenius app]# go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go: downloading google.golang.org/protobuf v1.33.0
go: downloading google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
go: downloading google.golang.org/grpc v1.63.2
go: downloading google.golang.org/protobuf v1.28.1
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/8e4054cf-ec36-4357-9edd-3062ebc3f4c2)

i think
this link is problem.

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/9190059d-79ac-410d-b336-3f3f2109290d)

no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1

hmm, how about this command ? 

protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto  --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
[root@Zenius collector-agent]# protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
google/protobuf/wrappers.proto: File not found.
v1/Annotation.proto: Import "google/protobuf/wrappers.proto" was not found or had errors.
v1/Annotation.proto:15:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:20:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:21:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:26:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:27:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:36:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:47:5: "google.protobuf.StringValue" is not defined.
v1/Annotation.proto:48:5: "google.protobuf.StringValue" is not defined.
try https://gist.github.com/olivoil/a2e0e4f3427db8b6ef4a6374f9c4cb32

> backup the old one, if you need
[root@Zenius collector-agent]# make
protoc --go_out=pinpoint-grpc-idl/proto/ --go-grpc_out=pinpoint-grpc-idl/proto  --proto_path=pinpoint-grpc-idl/proto/ --go-grpc_opt=paths=source_relative v1/Annotation.proto v1/Cmd.proto v1/CustomMetric.proto v1/Service.proto v1/Span.proto v1/Stat.proto v1/ThreadDump.proto
protoc-gen-go: program not found or is not executable
--go_out: protoc-gen-go: Plugin failed with status code 1.
make: *** [makefile:8: protoc] Error 1
[root@Zenius collector-agent]# go build
common/config.go:9:2: no required module provides package github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1; to add it:
        go get github.com/pinpoint-apm/pinpoint-c-agent/collector-agent/pinpoint-grpc-idl/proto/v1
[root@Zenius collector-agent]# protoc --version
libprotoc 3.5.0
[root@Zenius collector-agent]#
.bash_profile add

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN

and compile success
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/d55c5d61-e20d-4436-9c1d-890293e98231)


![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/1b5359f4-4203-428a-9ddb-cec556d5b2ee)

DB information cannot be retrieved.
which php framework you used ?
i'm not used framework.
by the way, which mysql client used?  just pdo ? 

> php-agent does not support c-level plugins yet, if used yii, `\yii\db\Connection` is `JoinPoint`
[root@Zenius lib]# pwd
/app/mysql/lib
[root@Zenius lib]# ls
libmariadbclient.a  libmariadb.so  libmariadb.so.3  libmysqlclient.a  libmysqlclient_r.a  libmysqlclient_r.so  libmysqlclient.so  libmysqlservices.a  pkgconfig  plugin
why not call tree?
my project 
[html.zip](https://github.com/pinpoint-apm/pinpoint-c-agent/files/15019174/html.zip)

As c-level function does not support yet, I will re-implement all plugins to support c-level in future.  

> sorry 


I don't know how to create a custom plugin.
I'm just an operator, not a developer.
Can you tell me how to set it up?
@killen9  

I find your project does not follow the `psr-4`, that means you can't use this version, even the custom plugin.

> Ref 

- psr-4 https://www.php-fig.org/psr/psr-4/
I tag this issue into next major version.
In addition to db information, I also want to display call-tree (trace) information and mem information.
I would appreciate your help.
![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/0aa0b0f6-3f72-496b-8b2b-5f54aef2ba32)

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/3464b1b6-5191-4ad9-acf2-16c6b032c431)

![image](https://github.com/pinpoint-apm/pinpoint-c-agent/assets/160205404/5ce682a6-3563-4606-864d-1affe66d1d53)


@killen9  

you can use `Pinpoint\Plugins\Sys\PDO` as your PDO plugins on php. 

Supported list:  
https://github.com/pinpoint-apm/pinpoint-php-aop/tree/dev/lib/Pinpoint/Plugins/Sys

How should I apply it?
hmm, I find your project use `mysql_connect` , it's not support any more. 

try use PDO, or mysqli

## Ref

- mysql_connect https://www.php.net/manual/en/function.mysql-connect.php
I don't know much about php.
I would appreciate it if you could tell me how to apply it to my project.
OK, 

1. remove deprecated style for handle mysql, use [PDO_MYSQL](https://www.php.net/manual/en/ref.pdo-mysql.php) or [msyqli](https://www.php.net/manual/en/book.mysqli.php) instead.
2. After `1` is done, use pinpoint plugins class to replace PDO_MYSQL or msyqli
  - PDO -> Pinpoint\Plugins\Sys\PDO\PDO
  - mysqli=Pinpoint\Plugins\Sys\mysqli\mysqli

> this older file may help you https://github.com/pinpoint-apm/pinpoint-c-agent/blob/v0.4.10/testapps/PHP/Plugins/setting.ini
I deleted the DB and installed mariadb 10.11 using yum.

However, DB information and trace still do not appear.
Which db extension you used ?  PDO or mysqli ?

I will post an example for you.

Fix patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 2aebdf21..d83782a4 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -6,7 +6,7 @@ jobs:
   cpp:
     strategy:
       matrix:
-        os: [ubuntu-latest, macos-latest]
+        os: [ubuntu-latest, macos-13]
     runs-on: ${{ matrix.os }}
     steps:
       - uses: actions/checkout@v2
@@ -119,7 +119,7 @@ jobs:
   Python:
     strategy:
       matrix:
-        os: [ubuntu-latest, macos-latest]
+        os: [ubuntu-latest, macos-13]
         python-version: ["3.8", "3.9", "3.10", "3.11"]
     runs-on: ${{ matrix.os }}
     steps:
diff --git a/src/PHP/pinpoint_php.cpp b/src/PHP/pinpoint_php.cpp
index a6c6434d..22ef0172 100644
--- a/src/PHP/pinpoint_php.cpp
+++ b/src/PHP/pinpoint_php.cpp
@@ -62,6 +62,7 @@ PHP_FUNCTION(pinpoint_end_trace);
 PHP_FUNCTION(pinpoint_add_clue);
 PHP_FUNCTION(pinpoint_add_clues);
 PHP_FUNCTION(pinpoint_unique_id);
+PHP_FUNCTION(pinpoint_get_this);
 PHP_FUNCTION(pinpoint_tracelimit);
 PHP_FUNCTION(pinpoint_drop_trace);
 PHP_FUNCTION(pinpoint_start_time);
@@ -145,6 +146,7 @@ const zend_function_entry pinpoint_php_functions[] = {
   PHP_FE(pinpoint_start_trace, arginfo_add_id) 
   PHP_FE(pinpoint_end_trace, arginfo_add_id)
   PHP_FE(pinpoint_unique_id, arginfo_none) 
+  PHP_FE(pinpoint_get_this, arginfo_none) 
   PHP_FE(pinpoint_status, arginfo_none) 
   PHP_FE(pinpoint_get_func_ref_args, arginfo_none)
   PHP_FE(pinpoint_drop_trace, arginfo_add_id) 
@@ -214,6 +216,17 @@ PHP_FUNCTION(pinpoint_drop_trace) {
   RETURN_TRUE;
 }
 
+PHP_FUNCTION(pinpoint_get_this) {
+
+  // zend_execute_data *ex = EX(prev_execute_data);
+  // ex = ex->prev_execute_data;
+  // return_value = &ex->This;
+  // zend_weakref_get(execute_data->prev_execute_data->This, );
+  // zend_weakref_get(execute_data->prev_execute_data->This, return_value);
+  // RETURN_OBJ(&execute_data->prev_execute_data->This);
+  RETURN_ZVAL(&execute_data->prev_execute_data->This, 0, 0);
+}
+
 PHP_FUNCTION(pinpoint_set_context) {
   long _id = -1;
   std::string key;
@@ -630,7 +643,7 @@ PHP_MINIT_FUNCTION(pinpoint_php) {
   zend_error_cb = apm_error_cb;
 
   pinpoint_set_agent(PPG(co_host), PPG(w_timeout_ms), PPG(tracelimit), 1500);
-  if (PPG(utest_flag) == 1) {
+  if (PPG(debug_report) == 1) {
     register_logging_cb(pinpoint_log, 1);
   } else {
     register_logging_cb(pinpoint_log, 0);


Test patch:
diff --git a/testapps/SimplePHP/composer.json b/testapps/SimplePHP/composer.json
new file mode 100644
index 00000000..fe6dbadb
--- /dev/null
+++ b/testapps/SimplePHP/composer.json
@@ -0,0 +1,13 @@
+{
+    "name": "root/simple-php",
+    "type": "project",
+    "autoload": {
+        "psr-4": {
+            "SimplePHP\\": "src/"
+        }
+    },
+    "require": {
+        "pinpoint-apm/pinpoint-php-aop": "v2.2.0",
+        "mongodb/mongodb": "^1.18"
+    }
+}
\ No newline at end of file
diff --git a/testapps/SimplePHP/php.ini b/testapps/SimplePHP/php.ini
new file mode 100644
index 00000000..a9096689
--- /dev/null
+++ b/testapps/SimplePHP/php.ini
@@ -0,0 +1,11 @@
+extension=mongodb.so
+
+[pinpoint_php]
+extension=pinpoint_php
+pinpoint_php.CollectorHost=tcp:dev-collector:10000
+pinpoint_php.SendSpanTimeOutMs=0
+pinpoint_php.DebugReport=true
+
+[error_log]
+error_reporting = E_ALL | E_STRICT
+log_errors= On
\ No newline at end of file
diff --git a/testapps/SimplePHP/run.php b/testapps/SimplePHP/run.php
new file mode 100644
index 00000000..d8029c23
--- /dev/null
+++ b/testapps/SimplePHP/run.php
@@ -0,0 +1,101 @@
+<?php
+
+/**
+ * 1. if you have questions,please create an issue on https://github.com/pinpoint-apm/pinpoint-c-agent/issues
+ * 2. if need more examples, please let us known by issue.
+ * */
+
+require_once __DIR__ . '/vendor/autoload.php';
+
+define('AOP_CACHE_DIR', __DIR__ . '/Cache');
+define('APPLICATION_NAME', 'cd.dev.test.php'); // your application name
+define('APPLICATION_ID', 'cd.dev.test.run');  // your application id
+define('PP_REQ_PLUGINS', SimplePHP\RequestPlugin::class);
+require_once __DIR__ . '/vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php';
+
+use Pinpoint\Plugins\Sys\PDO\PDO;
+use Pinpoint\Plugins\Sys\mysqli\Mysqli;
+
+$mysql_host = "dev-mysql";
+$mongodb_host = "mongodb";
+$mariadb_host = "dev-mariadb";
+function call_mysql()
+{
+    global $mysql_host;
+    $username = "root";
+    $password = "password";
+    $dbname = "employees";
+
+    $conn = new PDO("mysql:host=$mysql_host;port=33060;dbname=$dbname", $username, $password);
+    $stmt = $conn->prepare("SELECT * FROM `dept_emp_latest_date` LIMIT 1000;");
+    $stmt->execute();
+
+    $sql = 'SELECT name, dept_no, dept_name FROM departments ORDER BY dept_name LIMIT 10';
+    foreach ($conn->query($sql) as $row) {
+        print $row['dept_no'] . "\t";
+        print $row['dept_name'] . "\n";
+    }
+
+    $conn = null;
+}
+
+function call_mysqli()
+{
+    global $mysql_host;
+    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
+    $mysqli = new mysqli($mysql_host, "root", "password", "employees", 33060);
+
+    $result = $mysqli->query("SELECT * FROM `dept_emp_latest_date` LIMIT 1000;");
+    printf("Select returned %d rows.\n", $result->num_rows);
+
+    $stmt = $mysqli->prepare("SELECT * FROM employees WHERE emp_no=?");
+    $id = 10005;
+    $stmt->bind_param("i", $id);
+    $stmt->execute();
+    $stmt->fetch();
+}
+
+function call_mariadb()
+{
+    global $mariadb_host;
+    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
+    // 33061 , is the port of mariadb server
+    $mysqli = new mysqli($mariadb_host, "root", "password", "test", 33061);
+
+    $result = $mysqli->query("SELECT * FROM `contacts` LIMIT 1000;");
+    printf("Select returned %d rows.\n", $result->num_rows);
+
+    $stmt = $mysqli->prepare("INSERT INTO contacts (name,age,email) VALUES(?, ?, ?)");
+    $name = "eeliu";
+    $age = 18;
+    $email = "eeliu@navercorp.com";
+    $stmt->bind_param("sis", $name, $age, $email);
+    $stmt->execute();
+}
+
+function call_mongodb()
+{
+    global $mongodb_host;
+    $client = new MongoDB\Client("mongodb://$mongodb_host:27017");
+
+    $db = $client->test2;
+    echo "Database test2 created/selected<br>";
+
+    $coll = $db->selectCollection("mycoll");
+    echo "Collection mycoll created/selected<br>";
+
+    $coll->insertOne(['foo' => 'bar']);
+
+    echo "Result:<br>";
+    var_dump($coll->findOne(['foo' => 'bar']));
+}
+
+function main()
+{
+    call_mysql();
+    call_mysqli();
+    call_mariadb();
+    call_mongodb();
+}
+
+main();
diff --git a/testapps/SimplePHP/src/RequestPlugin.php b/testapps/SimplePHP/src/RequestPlugin.php
new file mode 100644
index 00000000..cfd9b332
--- /dev/null
+++ b/testapps/SimplePHP/src/RequestPlugin.php
@@ -0,0 +1,36 @@
+<?php
+namespace SimplePHP;
+
+use Pinpoint\Plugins\PinpointPerRequestPlugins;
+use Pinpoint\Common\UserFrameworkInterface;
+use Pinpoint\Common\AspectClassHandle;
+use MongoDB;
+
+class RequestPlugin extends PinpointPerRequestPlugins implements UserFrameworkInterface
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+    public function joinedClassSet(): array
+    {
+        $cls = [];
+
+        $classHandler = new AspectClassHandle(MongoDB\Client::class);
+        $classHandler->addJoinPoint('__construct', \Pinpoint\Plugins\MongoPlugin\MongoPlugin::class);
+        $cls[] = $classHandler;
+
+        $classHandler = new AspectClassHandle(MongoDB\Collection::class);
+        $classHandler->addJoinPoint('insertOne', \Pinpoint\Plugins\MongoPlugin\MongoPlugin::class);
+        $classHandler->addJoinPoint('updateOne', \Pinpoint\Plugins\MongoPlugin\MongoPlugin::class);
+        $classHandler->addJoinPoint('deleteMany', \Pinpoint\Plugins\MongoPlugin\MongoPlugin::class);
+        $classHandler->addJoinPoint('find', \Pinpoint\Plugins\MongoPlugin\MongoPlugin::class);
+        $cls[] = $classHandler;
+
+        return $cls;
+    }
+    public function userFindClass(&$loader): callable
+    {
+        return NULL;
+    }
+}
\ No newline at end of file
diff --git a/testapps/compose.yaml b/testapps/compose.yaml
index 0b1304c9..e7a13be6 100644
--- a/testapps/compose.yaml
+++ b/testapps/compose.yaml
@@ -25,6 +25,25 @@ services:
       timeout: 10s
       retries: 10
 
+  dev-mariadb:
+    image: mariadb
+    environment:
+      MYSQL_ROOT_PASSWORD: password
+      MYSQL_DATABASE: test
+      # MYSQL_USER: root
+      # MYSQL_PASSWORD: password
+    volumes:
+      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
+    ports:
+      - "33061:3306"
+    healthcheck:
+      test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
+      start_period: 1m
+      start_interval: 10s
+      interval: 1m
+      timeout: 5s
+      retries: 3  
+
   dev-mysql-setup:
     image: mysql:5.7
     depends_on:
@@ -190,8 +209,8 @@ services:
     hostname: mongodb
     healthcheck:
       test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
-      # ports:
-      # - 27017:27017
+    ports:
+    - 27017:27017
 
   python-plugins:
     build:
@@ -233,6 +252,22 @@ services:
       dockerfile: testapps/grpc_py_client.dockerfile
       context: ../
 
+  simple-php:
+    container_name: simple-php
+    depends_on:
+      dev-mysql:
+        condition: service_healthy
+      redis:
+        condition: service_healthy   
+      mongodb:
+        condition: service_healthy   
+      dev-mariadb:
+        condition: service_healthy 
+    restart: always
+    build:
+      dockerfile: testapps/simplephp.dockerfile
+      context: ../      
+
   postgres:
     image: postgres:14-alpine
     ports:
@@ -241,8 +276,8 @@ services:
       - POSTGRES_PASSWORD=pinpoint
       - POSTGRES_USER=test
       - POSTGRES_DB=test
-    # volumes:
-    #     - ./init.sql:/docker-entrypoint-initdb.d/init.sql      
+    volumes:
+        - ./init.sql:/docker-entrypoint-initdb.d/init.sql      
     restart: always
     healthcheck:
       test: [ "CMD-SHELL", "pg_isready", "-d", "db_prod" ]
diff --git a/testapps/init.sql b/testapps/init.sql
index 14379bd6..95cc7656 100644
--- a/testapps/init.sql
+++ b/testapps/init.sql
@@ -1,1 +1,8 @@
-CREATE DATABASE test;
+CREATE DATABASE IF NOT EXISTS  test ;
+CREATE TABLE IF NOT EXISTS `test`.`contacts` (
+  `id` INT(11) NOT NULL AUTO_INCREMENT,
+  `name` VARCHAR(100) NOT NULL,
+  `age` INT(3) NOT NULL,
+  `email` VARCHAR(100) NOT NULL,
+  PRIMARY KEY  (`id`)
+);
\ No newline at end of file
diff --git a/testapps/simplephp.dockerfile b/testapps/simplephp.dockerfile
new file mode 100644
index 00000000..0088bc22
--- /dev/null
+++ b/testapps/simplephp.dockerfile
@@ -0,0 +1,20 @@
+FROM ubuntu:20.04
+ENV TZ=Asia/Shanghai
+ENV LC_CTYPE=en_US.UTF-8
+WORKDIR /workspace
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+RUN DEBIAN_FRONTEND="noninteractive" apt update && apt-get install -y build-essential git php7.4 php7.4-dev  php7.4-curl  php7.4-mysql
+COPY testapps/SimplePHP/php.ini /etc/php/7.4/cli/php.ini
+COPY testapps/SimplePHP /workspace
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
+RUN git clone --recurse-submodules --depth 1 --branch 1.18.1 https://github.com/mongodb/mongo-php-driver.git && cd mongo-php-driver && phpize && ./configure && make -j && make install 
+RUN COMPOSER_ALLOW_SUPERUSER=1 composer update
+
+COPY config.m4 /pinpoint-c-agent/config.m4 
+COPY src/PHP /pinpoint-c-agent/src/PHP
+COPY common /pinpoint-c-agent/common
+COPY tests /pinpoint-c-agent/tests
+
+RUN cd /pinpoint-c-agent/ && phpize && ./configure && make && make install
+
+CMD [ "php" ,"/workspace/run.php" ]