Order API - permission denied

General ShopSite user discussion

Order API - permission denied

Postby David Gray » Thu Mar 16, 2006 10:22 am

I put a simple test script called gdaorder.php in my cgi-bin folder but I
see the following warning displayed in the Order API Merchandising screen
after I checkout a test order.

Warning:Thu, 16-Mar-2006 10:49:53
Unable to call Custom CGI
Reason: System error: Cannot spawn or execute process [gdaorder.php].
Permission denied.

The php file is set to 755, same as the customdump.cgi. I set the first line
of my script to "#!/usr/local/bin/php -q" as per Michael Wong's helpful php
cgi post and in /usr/local/bin I see a php, a php4-cli, a php5 and a php503
file so that looks ok I guess. I can run regular web php scripts no problem.
I'm on pair.com The test order has zero total value (I'm using a coupon to
make the total zero so I don't need to keep entering my payment info).

Any ideas why permission is denied? Thanks in advance.

--

David P. Gray
Gray Design Associates
David Gray
 

Re: Order API - permission denied

Postby David Gray » Thu Mar 16, 2006 11:04 am

Please disregard my post - it's working now. The execute permissions on the
script had gotten cleared somehow after I checked them.

--

David P. Gray
Gray Design Associates
David Gray
 

trying the same thing but I am unable to get php to work

Postby hollettster » Sat Apr 14, 2007 9:49 pm

Can you give a little more info on how you got the php to work as a custom script. I have been trying and can't seem to get it to work. I basically want to get all the values (not credit card stuff but basic info)from the order then pass them to a MySQL dbase on my web server. Any help would be much appreciated. Thanks in advance.
hollettster
 
Posts: 6
Joined: Mon Apr 09, 2007 7:58 am

Postby robm » Sat Apr 14, 2007 10:08 pm

Check out this previous post which is quite detailed:

http://support.shopsite.com/forums/viewtopic.php?t=2028
robm
 
Posts: 463
Joined: Fri Aug 04, 2006 5:46 pm
Location: Connecticut

Postby dgray » Sun Apr 15, 2007 1:50 pm

Yes, that post by Michael Wong is the one I used to implement a php order API script - it tells you the key missing ingredients to do it. It was intended for custom shipping but works just as well for the order API.
dgray
 
Posts: 54
Joined: Fri Sep 08, 2006 9:06 am

I used the Wong Script

Postby hollettster » Sun Apr 15, 2007 8:57 pm

I used the wong script and I get an Internal error 500. Misconfiguration. I set and rechecked the permissions to 755. I am on Pair but not sure where to go from here. I commented out all the if code so the else part is FORCED to run. Here is what I have:

#!/usr/local/bin/php -q
<?PHP

// Note: $_POST variable not available since this script is called as a
// CGI script, so we have to read in our params from stdin, with length
// determined by the CONTENT_LENGTH environment variable.

// Read in POST parameters sent by ShopSite
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%{$SERVER['CONTENT_LENGTH']}s",$query_string);

// And now we split the params into the $params array.
parse_str($query_string,$params);

//if ( $params['cust_country'] && $params['item_total'] )
//{
// You would normally include code here for determining
// your shipping rates and options. Remember that all input
// parameters are in the $params array.
//
// The variables to set for the output (assuming you use the
// output code included in this example) are $status, $options,
// and $prices. $options and $prices are arrays.
//}
//else
//{
$status="fail";
$error=urlencode("Params are ".var_export($params,true));
$option_count=0;
//}

// Output data to ShopSite
echo "status=".$status."\n";
echo "option_count=".$option_count."\n";
if ($status="fail")
{
echo "error=".$error."\n";
}
for ( $option = 1; $option <= $option_count; $option += 1 )
{
echo "s".$option."option=".$options["$option"]."\n";
echo "s".$option."price=".$prices["$option"]."\n";
}

?>
hollettster
 
Posts: 6
Joined: Mon Apr 09, 2007 7:58 am

Postby dgray » Mon Apr 16, 2007 3:16 am

I'm also on Pair.

One thing I remember that was crucial was - don't have any white space outside the php enclosures (that is before <?PHP and after ?>) or bad things happen because the http stream gets corrupted.

Also, I notice I don't have any echo statements in my script as I seem to recall these also made it go wrong. I did all my final testing and error checking by mailing stuff to myself from the script. Maybe the echo statements are needed for custom shipping API but I was working with the Order API. I don't use the custom shipping API so I don't know.
dgray
 
Posts: 54
Joined: Fri Sep 08, 2006 9:06 am


Return to User Forum

Who is online

Users browsing this forum: No registered users and 93 guests