Следующие темы не решают эту проблему для меня: -
Неустранимая ошибка: класс 'Google \ Auth \ OAuth2' не найден
Class 'Google \ Auth \ OAuth2 'не найден
Неустранимая ошибка: необученная ошибка: класс' Google_Client 'не найден
и даже этот: -
Реализация входа в Oauth2, фатальная ошибка: класс 'Google_Service' не найден
Привет всем,
Точные журналы из error_log приведены ниже: -
PHP Fatal error: Uncaught Error: Class 'Google\Auth\OAuth2' not found in /home/.../public_html/.../google/Client.php:954
Stack trace:
#0 /home/.../public_html/.../google/Client.php(943): Google_Client->createOAuth2Service()
#1 /home/.../public_html/.../google/Client.php(338): Google_Client->getOAuth2Service()
#2 /home/.../public_html/.../logintest.php(39): Google_Client->createAuthUrl()
#3 {main}
thrown in /home/.../public_html/.../google/Client.php on line 954
Ниже приведены несколько строк из Client.php
public function getOAuth2Service()
{
if (!isset($this->auth)) {
$this->auth = $this->createOAuth2Service();
}
return $this->auth;
}
/**
* create a default google auth object
*/
protected function createOAuth2Service()
{
$auth = new OAuth2(
[
'clientId' => $this->getClientId(),
'clientSecret' => $this->getClientSecret(),
'authorizationUri' => self::OAUTH2_AUTH_URL,
'tokenCredentialUri' => self::OAUTH2_TOKEN_URI,
'redirectUri' => $this->getRedirectUri(),
'issuer' => $this->config['client_id'],
'signingKey' => $this->config['signing_key'],
'signingAlgorithm' => $this->config['signing_algorithm'],
]
);
return $auth;
}
Строка № 3 трассировки стека указывает (для меня), что включение autoload.php и Client.php сделаноправильно
Я на виртуальном хостинге, поэтому не могу установить через Composer.Я просто скачиваю и копирую файлы (в соответствии с https://github.com/googleapis/google-api-php-client#installation).
Вот так я включил файлы
set_include_path(get_include_path() . PATH_SEPARATOR . '/../google/');
include_once __DIR__ . '/../google/autoload.php';
require_once 'google/Client.php';
require_once 'google/Service.php';
Триггер ошибки в следующей строке в коде PHP: -
$url = $client->createAuthUrl();
Пожалуйста, помогите!