本文最后更新于 2024-08-04,文章内容可能已经过时!

准备工作

安装PHP

一、安装composer

apt install composer

# 出错就重新安装
sudo apt remove composer
sudo apt autoremove
sudo apt install composer

二、创建composer.json添加以下参数

{
    "require": {
        "tencentcloud/tencentcloud-sdk-php": "^3.0",
        "qcloud/cos-sdk-v5": "^2.6"
    }
}

三、执行命令

composer require tencentcloud/tencentcloud-sdk-php

三、问题解决

  • 安装xml

sudo apt update
sudo apt install php7.4-simplexml
  • 安装指定PHP版本

bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)
  • 出错忽略

--ignore-platform-req=ext-curl
  • composer下载卡住

https://github.com/TencentCloud/tencentcloud-sdk-php