通过函数计算的Custom Runtime,您可以在函数计算平台使用PHP来编写函数。本文介绍快速部署和调用PHP函数的详细步骤。您也可以修改PHP示例中的代码,实现您的需求。
前提条件
步骤一:准备环境
安装Funcraft,最简单的方式就是直接下载可执行的二进制文件。
通过函数计算的Custom Runtime,您可以在函数计算平台使用PHP来编写函数。本文介绍快速部署和调用PHP函数的详细步骤。您也可以修改PHP示例中的代码,实现您的需求。
安装Funcraft,最简单的方式就是直接下载可执行的二进制文件。
fun --version
检查安装是否成功。fun config
配置Funcraft。然后按照提示依次配置Account ID、Access Key ID、Access Key Secret、Default region name。fun config
Aliyun Account ID 1234xxx
Aliyun Access Key ID xxxx
Aliyun Access Key Secret xxxx
Default region name cn-xxxx
The timeout in seconds for each SDK client invoking 300
The maximum number of retries for each SDK client 5
Allow to anonynously report usage statistics to improve the tool over time? (Y/n)
git clone https://github.com/awesome-fc/fc-custom-demo
cd fc-custom-demo
cd php74-swoole-demo
fun deploy -y
Waiting for service php74-swoole-demo to be deployed...
Waiting for function fc-php74-swoole to be deployed...
Waiting for packaging function fc-php74-swoole code...
The function fc-php74-swoole has been packaged. A total of 2 files were compressed and the final size was 800 B
function fc-php74-swoole deploy success
service php74-swoole-demo deploy success
fun invoke -e "Hello World"
========= FC invoke Logs begin =========
FC Invoke Start RequestId: 2d7d089d-7a41-4d81-a932-01d452ead907
string(11) "Hello World"
FC Invoke End RequestId: 2d7d089d-7a41-4d81-a932-01d452ead907
Duration: 1.01 ms, Billed Duration: 100 ms, Memory Size: 512 MB, Max Memory Used: 32.68 MB
========= FC invoke Logs end =========
FC Invoke Result:
Hello World
在文档使用中是否遇到以下问题
更多建议
匿名提交