Adwords API using PHP getting error when GetRefreshToken.php is run

301 views
Skip to first unread message

ch...@thinkchris.ca

unread,
Jan 13, 2017, 12:33:20 PM1/13/17
to AdWords API Forum
I'm getting the following error when running GetRefreshToken.php from SSH.

[root@myroot Auth]# php -f GetRefreshToken.php
PHP
Warning:  require(../../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/vhosts/mysite.com/googleads-php-lib-master/examples/Auth/GetRefreshToken.php on line 19


Here is a screenshot of my file structure. I'm not seeing the vendor/autoload.php in the files? 







Shwetha Vastrad (AdWords API Team)

unread,
Jan 13, 2017, 4:20:39 PM1/13/17
to AdWords API Forum
Hi Chris,

You'll need to use Composer to install the latest version of the AdWords API PHP client library, which will update the required dependencies in your environment. If you downloaded the example files directly from the repository, these dependencies may not be configured correctly. Could you try it out and let me know if it works? 

Regards,
Shwetha, AdWords API Team.

Chris

unread,
Jun 26, 2017, 1:00:43 PM6/26/17
to AdWords API Forum
I'm facing the EXACT same problem.
I used composer to install the files.

But, as the other Chris states, every single file I try to use seems to mismatch the folder structure.
I was able to get the GetRefreshToken.php to work, but only by virtue of editing line 19 to read require '../../../../../vendor/autoload.php', with an extra ..

Now, if I try to run any reports (eg. /vendor/googleads/googleads-php-lib/examples/AdWords/v201705/Reporting/GetReportFields.php), etc, they come up with similar directory structure problems, with similar errors on line 19.
Very frustrating!!

If I move the .php file itself up one directory, the GetReportFields.php runs but I get the following:

Fatal error: Uncaught InvalidArgumentException: Config file not found as specified: 'adsapi_php.ini' or in the home directory: '/Users/chris/adsapi_php.ini'. in /Users/chris/Google Drive/<my project's directory>/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/ConfigurationLoader.php:63.................

Can you provide us with a sense of what the folder structure *should* look like?
That might prove exceptionally helpful for me, and others.

Shwetha Vastrad (AdWords API Team)

unread,
Jun 26, 2017, 3:25:04 PM6/26/17
to AdWords API Forum
Hi Chris, 

The examples in the AdWords API PHP client library looks for the adsapi_php.ini configuration file in your home directory. Since your question is specific to the PHP client library, I would suggest that you create a thread in the library's issue tracker so they can help you out. 
Reply all
Reply to author
Forward
0 new messages