【问题标题】:Google Sheets API installation problem - quickstart.php not doing anythingGoogle Sheets API 安装问题 - quickstart.php 没有做任何事情
【发布时间】:2019-01-04 17:57:13
【问题描述】:

我正在尝试关注 this guide 以将我的网站连接到 Google Sheets API,但在第 4 步出现问题。

我通过 SSH 连接到我的网站以访问控制台,使用“cd”命令进入存储所有必需文件的工作目录,然后按照指南键入命令“php quickstart.php”,什么也没有发生在命令行中。

没有结果,没有错误,什么都没有,有一个新的空行在等待一个新的命令。

帮助我解开这个谜团的唯一证据是我在浏览器(不是命令行)中打开 PHP 文件时收到的一条消息:

已弃用:google-api-php-client 的自动加载器已在 2.0.0 中移至 vendor/autoload.php。此重定向将在 2.1 中删除。请调整您的代码以使用新位置。在 /home/*****/public_html/PHP/mailinglist/google-api-php-client/src/vendor/autoload.php 第 19 行

致命错误:未捕获的异常:此应用程序必须在 命令行。在 /home/****/public_html/PHP/mailinglist/quickstart.php:5 堆栈 跟踪:#0 {main} 投入 /home/****/public_html/PHP/mailinglist/quickstart.php 在第 5 行

关于修复的任何想法?如果有帮助,我的网站将存储在由 cPanel 管理的共享主机上。

【问题讨论】:

    标签: php api ssh google-sheets


    【解决方案1】:

    尝试以这种方式运行脚本:
    php -d display_errors=on quickstart.php

    也许你的 php 设置默认禁用了display_errors

    【讨论】:

    • 好主意!新结果Deprecated: google-api-php-client's autoloader was moved to vendor/autoload.php in 2.0.0. This redirect will be removed in 2.1. Please adjust your code to use the new location. in /home/***/public_html/PHP/mailinglist/google-api-php-client/src/vendor/autoload.php on line 19 Fatal error: Uncaught Error: Class 'Google_Client' not found in /home/***/public_html/PHP/mailinglist/quickstart.php:14 Stack trace: #0 /home/***/public_html/PHP/mailinglist/quickstart.php(63): getClient() #1 {main} thrown in /home/***/public_html/PHP/mailinglist/quickstart.php on line 14
    • 现在,当我真正查看“autoload.php”中的代码时,似乎实际上没有任何东西可以加载所需的文件:link - 你认为我需要手动包含所有文件一个一个?
    • 不,如果你正在使用 composer 那么autoload.php 应该加载你所有的依赖,你现在有任何错误吗?
    • 我没有使用 composer,我想手动加载它,因为我还没有弄清楚如何在我的托管服务提供商中使用 composer
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    • 2016-10-02
    • 2013-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多