CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviContribute GoogleIPN.php error when running PHP as CGI
Pages: [1]

Author Topic: CiviContribute GoogleIPN.php error when running PHP as CGI  (Read 3505 times)

maryee

  • Guest
CiviContribute GoogleIPN.php error when running PHP as CGI
October 30, 2007, 02:23:13 pm
I think I've identified a minor issue with using Google Checkout as the payment processor for CiviCRM, but am new to this and don't know whom to tell about it...

Here's the issue and suggested solution:

I recently installed CiviCRM at a host (Dreamhost) where they run PHP as CGI. The post-order callback from Google to googleNotify.php fails with the error:

Quote
Fatal error: Call to undefined function getallheaders() in [MY_PATH]/drupal/sites/all/modules/civicrm/CRM/Core/Payment/GoogleIPN.php on line 575

I think the problem is that getallheaders() is not available when PHP is run as CGI. The problem can be resolved by patching GoogleIPN.php by:

1. Define the function emu_getallheaders() somewhere in GoogleIPN.php

from http://forums.digitalpoint.com/showthread.php?p=4768191:
Code: [Select]
function emu_getallheaders() {
   foreach($_SERVER as $name => $value)
       if(substr($name, 0, 5) == 'HTTP_')
           $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
   return $headers;
}

2. Replacing the single call to getallheaders() in GoogleIPN.php line 575.

Is this a problem worth addressing, and if so, is this an acceptable solution?
« Last Edit: October 30, 2007, 02:34:46 pm by maryee »

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviContribute GoogleIPN.php error when running PHP as CGI
October 30, 2007, 04:51:09 pm

hey maryee

thanx for investigating and the patch. can you please file an issue and add the link to this forum.

We'll fix it in 2.0

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • CiviContribute GoogleIPN.php error when running PHP as CGI

This forum was archived on 2017-11-26.