AddAdGroups.php gives error

152 views
Skip to first unread message

Roy Roes

unread,
Jun 8, 2012, 9:03:52 AM6/8/12
to adwor...@googlegroups.com
I'm testing the Adwords API in the sandbox.
 
When I try to add AdGroups to a campaign with the AddAdGroups.php from the PHP client library, I get the following error in Chrome: Error 324 (net::ERR_EMPTY_RESPONSE)

 

With a bit of debugging the line causing the error: $result = $adGroupService->mutate($operations);

 

The content of $operations:

 

Array ( [0] => AdGroupOperation Object ( [operand] => AdGroup Object ( [id] => [campaignId] => 123456 [campaignName] => [name] => Earth to Mars Cruise #4fd1e737a9007 [status] => ENABLED [bids] => ManualCPCAdGroupBids Object ( [keywordMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 1000000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [keywordContentMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 750000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [siteMaxCpc] => [enhancedCpcEnabled] => [interactionBids] => [AdGroupBidsType] => [_parameterMap:private] => Array ( [AdGroupBids.Type] => AdGroupBidsType ) ) [experimentData] => [stats] => ) [operator] => ADD [OperationType] => [_parameterMap:private] => Array ( [Operation.Type] => OperationType ) ) [1] => AdGroupOperation Object ( [operand] => AdGroup Object ( [id] => [campaignId] => 123456 [campaignName] => [name] => Earth to Mars Cruise #4fd1e737a9035 [status] => ENABLED [bids] => ManualCPCAdGroupBids Object ( [keywordMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 1000000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [keywordContentMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 750000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [siteMaxCpc] => [enhancedCpcEnabled] => [interactionBids] => [AdGroupBidsType] => [_parameterMap:private] => Array ( [AdGroupBids.Type] => AdGroupBidsType ) ) [experimentData] => [stats] => ) [operator] => ADD [OperationType] => [_parameterMap:private] => Array ( [Operation.Type] => OperationType ) ) )
 
Can anyone tell me what I'm doing wrong?

Kevin Winter

unread,
Jun 12, 2012, 3:45:48 PM6/12/12
to adwor...@googlegroups.com
Hi,
  It sounds like you may be seeing a SOAP fault and that prevents your PHP code from writing a response.  Could you please enable logging (check the README) and see if there's an error message?

- Kevin Winter
AdWords API Team

Roy Roes

unread,
Jun 13, 2012, 2:07:34 AM6/13/12
to adwor...@googlegroups.com
Hi Kevin,
 
I enabled logging and used the LogAll function, but nothing is logged.
Even the SOAP request isn't logged.
 
I've also tested the log with the AddCampaign.php and that's working fine.
So the log is configured properly.

Kevin Winter

unread,
Jun 13, 2012, 12:10:37 PM6/13/12
to adwor...@googlegroups.com
Hi,

Could you try to add some error handling around the mutate call and see if that catches the error?

- Kevin Winter
AdWords API Team

Roy Roes

unread,
Jun 14, 2012, 5:27:36 AM6/14/12
to adwor...@googlegroups.com
Hi,
 
Added the error handling around the mutate call as you suggested, but without any result.
It didn't catch any error.
 
I still get the following error in Chrome: Error 324 (net::ERR_EMPTY_RESPONSE)

Kevin Winter

unread,
Jun 14, 2012, 11:00:58 AM6/14/12
to adwor...@googlegroups.com
Hi,
  Ok, my next suggestion would be to change the catch you added to catch Exception (rather than just SoapFault) and try to set up an error handler: http://us.php.net/manual/en/function.set-error-handler.php

Ideally one of these tricks will let us see whats causing your script to not return a response.  You might also want to add some output statements so your script tries to output prior to the line where it currently breaks.

- Kevin Winter
AdWords API Team

Roy Roes

unread,
Jun 15, 2012, 6:06:05 AM6/15/12
to adwor...@googlegroups.com
Hi,
 
I try to catch the Exception like this:

  try {
   $result = $adGroupService->mutate($operations);
  } catch (Exception $e) {
   printf("An error has occurred: %s\n", $e->getMessage());
  }

But no exception is catched...

I can output anything before the line
$result = $adGroupService->mutate($operations);
But I have to comment this line out to get the output.

When I output $operations just before the mutate I get:

Array ( [0] => AdGroupOperation Object ( [operand] => AdGroup Object ( [id] => [campaignId] => 673033 [campaignName] => [name] => Earth to Mars Cruise #4fdb074a0055c [status] => ENABLED [bids] => ManualCPCAdGroupBids Object ( [keywordMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 1000000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [keywordContentMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 750000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [siteMaxCpc] => [enhancedCpcEnabled] => [interactionBids] => [AdGroupBidsType] => [_parameterMap:private] => Array ( [AdGroupBids.Type] => AdGroupBidsType ) ) [experimentData] => [stats] => ) [operator] => ADD [OperationType] => [_parameterMap:private] => Array ( [Operation.Type] => OperationType ) ) [1] => AdGroupOperation Object ( [operand] => AdGroup Object ( [id] => [campaignId] => 673033 [campaignName] => [name] => Earth to Mars Cruise #4fdb074a0059c [status] => ENABLED [bids] => ManualCPCAdGroupBids Object ( [keywordMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 1000000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [keywordContentMaxCpc] => Bid Object ( [amount] => Money Object ( [microAmount] => 750000 [ComparableValueType] => [_parameterMap:private] => Array ( [ComparableValue.Type] => ComparableValueType ) ) ) [siteMaxCpc] => [enhancedCpcEnabled] => [interactionBids] => [AdGroupBidsType] => [_parameterMap:private] => Array ( [AdGroupBids.Type] => AdGroupBidsType ) ) [experimentData] => [stats] => ) [operator] => ADD [OperationType] => [_parameterMap:private] => Array ( [Operation.Type] => OperationType ) ) )

I just used the AddAdGroups.php from the client library and filled in the campaign id.
So I can't do much wrong there, I think.

AddCampaign.php and GetCampaigns.php are working fine.

Thank you for your help.

Kevin Winter

unread,
Jun 19, 2012, 10:11:46 AM6/19/12
to adwor...@googlegroups.com
Hi,
  Did you have any luck trying the error handler as I suggested?  You might want to also enable logging and check the log after making the request: http://code.google.com/p/google-api-adwords-php/source/browse/trunk/README#129

- Kevin Winter
AdWords API Team

Roy Roes

unread,
Jun 19, 2012, 10:18:19 AM6/19/12
to adwor...@googlegroups.com
Hi,
 
Nope, can't catch the Exception (see my previous post)...
 
I tried $user->LogAll()
But nothing in the log files.
 
So I'm stuck right now...

Kevin Winter

unread,
Jun 19, 2012, 11:43:50 AM6/19/12
to adwor...@googlegroups.com
Hi,
  One of my colleagues suggested that PHP's error logs may contain some useful info.  He said that it sounds like PHP itself could be crashing - which can't be caught by the script.  If that doesn't work, another thing to try is to try running this from commandline - it may write something to console that helps debug this.

- Kevin Winter
AdWords API Team

Roy Roes

unread,
Jun 20, 2012, 5:12:39 AM6/20/12
to adwor...@googlegroups.com
Hi,
 
When I run the script in command prompt I get the following error:

ALERT - canary mismatch on efree() - heap overflow detected (attacker 'REMOTE_ADDR not set', file '/home/httpd/vhosts/mydomain.nl/httpdocs/aw_api/Google/Api/Ads/Common/Lib/AdsSoapClient.php', line 201)

 

Is that the error we are looking for?

Roy Roes

unread,
Jun 20, 2012, 7:13:36 AM6/20/12
to adwor...@googlegroups.com
I think I found something here:
 
 
But this isn''t ginving any solution other than using another php version.

Roy Roes

unread,
Jun 20, 2012, 11:03:05 AM6/20/12
to adwor...@googlegroups.com
 
Is there a workaround?
 
Because installing another php version on the server isn''t really an option.

Kevin Winter

unread,
Jun 20, 2012, 11:09:48 AM6/20/12
to adwor...@googlegroups.com
Hi,
  It sounds like this is a good explanation for the behavior you're seeing.  The Suhosin patch, as mentioned, causes problems when used with the AdWords PHP library that caused PHP to crash.  This explains the ERR_EMPTY_RESPONSE in chrome as well as the lack of logs.  I spoke with the old maintainer of the PHP library - there is no known workaround at this time - the SOAP modules in older versions is simply buggy.

- Kevin Winter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages