在 Laravel、Docker、未定义类型 'Grpc\ChannelCredentials' 中使用 Grpc
Using Grpc in Laravel, Docker, Undefined type 'Grpc\ChannelCredentials'
设置好一切以使用 grpc 后,
我的 composer.json
:
require: {
...
"grpc/grpc": "^1.34",
"spiral/php-grpc": "^1.4",
"spiral/roadrunner": "^1.9",
...
}
我创建新客户:
...
$client = new ExampleClient('localhost:9090',[
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
]);
...
在Docker中,我启用了grpc,protobuf:
docker-php-ext-enable grpc
docker-php-ext-enable protobuf
我在docker环境下检查了grpc和protobuf,输出:
/usr/local/etc/php/conf.d/docker-php-ext-grpc.ini,
/usr/local/etc/php/conf.d/docker-php-ext-protobuf.ini,
grpc
grpc support => enabled
grpc module version => 1.43.0
grpc.enable_fork_support => 0 => 0
grpc.grpc_trace => no value => no value
grpc.grpc_verbosity => no value => no value
grpc.log_filename => no value => no value
grpc.poll_strategy => no value => no value
protobuf
protobuf.keep_descriptor_pool_after_request => 0 => 0
但 Grpc\ChannelCredentials 未找到
感谢您的支持!
Grpc\ChannelCredentials
是通过 grpc 扩展 (grpc.so
) 添加的,因此您找不到它的文件。
设置好一切以使用 grpc 后,
我的 composer.json
:
require: {
...
"grpc/grpc": "^1.34",
"spiral/php-grpc": "^1.4",
"spiral/roadrunner": "^1.9",
...
}
我创建新客户:
...
$client = new ExampleClient('localhost:9090',[
'credentials' => \Grpc\ChannelCredentials::createInsecure(),
]);
...
在Docker中,我启用了grpc,protobuf:
docker-php-ext-enable grpc
docker-php-ext-enable protobuf
我在docker环境下检查了grpc和protobuf,输出:
/usr/local/etc/php/conf.d/docker-php-ext-grpc.ini,
/usr/local/etc/php/conf.d/docker-php-ext-protobuf.ini,
grpc
grpc support => enabled
grpc module version => 1.43.0
grpc.enable_fork_support => 0 => 0
grpc.grpc_trace => no value => no value
grpc.grpc_verbosity => no value => no value
grpc.log_filename => no value => no value
grpc.poll_strategy => no value => no value
protobuf
protobuf.keep_descriptor_pool_after_request => 0 => 0
但 Grpc\ChannelCredentials 未找到
感谢您的支持!
Grpc\ChannelCredentials
是通过 grpc 扩展 (grpc.so
) 添加的,因此您找不到它的文件。