简体   繁体   中英

Google PHP API Client Require Fail (Without using Composer)

I downloaded the Google API library from here https://github.com/googleapis/google-api-php-client . I unzipped it and uploaded it to my server at '/etc/'. I then put the path in my script as:

require_once '/var/www/html/example.com/etc/google-api-php-client-master/src/Google/autoload.php';

This is all per the doc on that page:

you can download the package in its entirety. The Releases page lists all stable versions. Download any file with the name google-api-php-client-[RELEASE_NAME].zip for a package including this library and its dependencies.

Uncompress the zip file you download, and include the autoloader in your project:

require_once '/path/to/google-api-php-client/vendor/autoload.php';

Server error log:

PHP Fatal error: Uncaught Exception: This library must be installed via composer or by downloading the full package. See the instructions at https://github.com/google/google-api-php-client#installation . in /var/www/html/example.com/etc/google-api-php-client-master/src/Google/autoload.php:14\\nStack trace:\\n#0 /var/www/html/example.com/etc/google_validate.php(2): require_once()\\n#1 {main}\\n thrown in /var/www/html/example.com/etc/google-api-php-client-master/src/Google/autoload.php on line 14, referer: https://chris-dev2.jove.com/etc/google.html

Did what I do somehow not download the package in its entirety ?

Go to the releases page, scroll to the bottom of the latest release and download the .zip asset. Don't choose the PHP54 file unless you explicitly are using PHP 5.4.

在此处输入图片说明

Extract the archive, move it to your project, and include the vendor/autoload.php file from the API client archive.

(If you're able to use Composer, it will be a better experience!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM