有什么已知的问题与PHP 5.3,以防止PHP SDK工作?

时间:2013-02-11 00:30:00

标签: php sdk paypal

我必须将Paypal Payment pro集成到客户的网站。我开始在我的服务器上安装paypal php SDK。它运行在PHP 5.2.17上,似乎工作得很完美。

当我完成测试时,我将SDK从我的服务器移动到运行php 5.3.2的客户端服务器,由于某种原因它无效。

一开始我们确定这是权限问题,因为脚本无法写入paypal.log文件

现在大约一周,我们正在与托管公司合作解决问题。 一个想法是将服务器回滚到5.2.17(以我的服务器的php版本为例)。这个改变解决了这个问题,但服务器上的其他网站搞砸了,这迫使我们回到5.3.2

我一直在寻找解决方案。我在这里找到的一个解决方案: PayPal error messages on PHP 5.3.1 与梨包有关。

任何人都知道为了让SDK工作,是否需要任何特殊的梨包?

以下是一些技术信息:

当我在错误报告设置为-1时尝试doDirectPayment示例时出现以下错误

其中5或6个:

Warning: error_log(../PayPal.log) [function.error-log]: failed to open stream: Permission denied in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPLoggingManager.php on line 60

1:

Strict Standards: Only variables should be passed by reference in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPUtils.php on line 99

其中大约12个:

Strict Standards: Non-static method PPUtils::convertXmlObjToArr() should not be called statically in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPUtils.php on line 99

和5h中的2个:

Notice: Class string not found. in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-cart/paypal/lib/PPXmlMessage.php on line 172

请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:ebay:api:PayPalAPI" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" ><soapenv:Header><ns:RequesterCredentials><ebl:Credentials><ebl:Username>yanivk_1359660748_biz_api1.gmail.com</ebl:Username><ebl:Password>1359660807</ebl:Password><ebl:Signature>AYWZfz56bBT.eby8WGW6PcSYJuLGAJAkQp0g-4el58kjzrOUFVSWTpE5</ebl:Signature></ebl:Credentials></ns:RequesterCredentials></soapenv:Header><soapenv:Body><ns:DoDirectPaymentReq><ns:DoDirectPaymentRequest><ebl:DoDirectPaymentRequestDetails><ebl:PaymentDetails><ebl:OrderTotal><ebl:currencyID>USD</ebl:currencyID><ebl:value>1.00</ebl:value></ebl:OrderTotal><ebl:ShipToAddress><ebl:Name>John Doe</ebl:Name><ebl:Street1>1 Main St</ebl:Street1><ebl:CityName>San Jose</ebl:CityName><ebl:StateOrProvince>CA</ebl:StateOrProvince><ebl:Country>US</ebl:Country><ebl:PostalCode>95131</ebl:PostalCode></ebl:ShipToAddress></ebl:PaymentDetails><ebl:CreditCard><ebl:CreditCardType>Visa</ebl:CreditCardType><ebl:CreditCardNumber>4079305435163119</ebl:CreditCardNumber><ebl:ExpMonth>01</ebl:ExpMonth><ebl:ExpYear>2014</ebl:ExpYear><ebl:CardOwner><ebl:PayerName><ebl:FirstName>John</ebl:FirstName><ebl:LastName>Doe</ebl:LastName></ebl:PayerName><ebl:PayerCountry>US</ebl:PayerCountry><ebl:Address><ebl:Name>John Doe</ebl:Name><ebl:Street1>1 Main St</ebl:Street1><ebl:CityName>San Jose</ebl:CityName><ebl:StateOrProvince>CA</ebl:StateOrProvince><ebl:Country>US</ebl:Country><ebl:PostalCode>95131</ebl:PostalCode></ebl:Address></ebl:CardOwner><ebl:CVV2>962</ebl:CVV2></ebl:CreditCard></ebl:DoDirectPaymentRequestDetails><ebl:Version>94.0</ebl:Version></ns:DoDirectPaymentRequest></ns:DoDirectPaymentReq></soapenv:Body></soapenv:Envelope>

回复:

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cc="urn:ebay:apis:CoreComponentTypes" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:ed="urn:ebay:apis:EnhancedDataTypes" xmlns:ebl="urn:ebay:apis:eBLBaseComponents" xmlns:ns="urn:ebay:api:PayPalAPI"><SOAP-ENV:Header><Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" xsi:type="wsse:SecurityType"></Security><RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType"><Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType"><Username xsi:type="xs:string"></Username><Password xsi:type="xs:string"></Password><Signature xsi:type="xs:string"></Signature><Subject xsi:type="xs:string"></Subject></Credentials></RequesterCredentials></SOAP-ENV:Header><SOAP-ENV:Body id="_0"><DoDirectPaymentResponse xmlns="urn:ebay:api:PayPalAPI"><Timestamp xmlns="urn:ebay:apis:eBLBaseComponents">2013-02-10T23:51:36Z</Timestamp><Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack><CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents">ccaa89a0e921f</CorrelationID><Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType"><ShortMessage xsi:type="xs:string">Transaction refused because of an invalid argument. See additional error messages for details.</ShortMessage><LongMessage xsi:type="xs:string">Order total is invalid.</LongMessage><ErrorCode xsi:type="xs:token">10401</ErrorCode><SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents">Error</SeverityCode></Errors><Version xmlns="urn:ebay:apis:eBLBaseComponents">94.0</Version><Build xmlns="urn:ebay:apis:eBLBaseComponents">5060305</Build><Amount xsi:type="cc:BasicAmountType" currencyID="USD">0.00</Amount></DoDirectPaymentResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

我知道这是一个非常具体的问题,熟悉这个问题的人的可能性很低,但我不得不问。

感谢。

1 个答案:

答案 0 :(得分:0)

解决上述每个错误:

Warning: error_log(../PayPal.log) [function.error-log]: failed to open stream: Permission
denied in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-
cart/paypal/lib/PPLoggingManager.php on line 60

这表示在所述路径上存在许可问题。确保该文件存在并具有适用于您的www-root(或任何正在运行Apache服务的用户)的权限。

Strict Standards: Only variables should be passed by reference in 
/home/brando/public_html/wp-content/plugins/ownapainting-shopping-
cart/paypal/lib/PPUtils.php on line 99

这表示变量的非最佳实践用法。我可以更深入地了解这一点,但基本上,某些东西是通过引用传递而不是通过值(谷歌它的差异)。

Strict Standards: Non-static method PPUtils::convertXmlObjToArr() should not be called 
statically in /home/brando/public_html/wp-content/plugins/ownapainting-shopping-
cart/paypal/lib/PPUtils.php on line 99

静态方法是类中的一种方法,可以在不实例化整个类的情况下调用它。此方法似乎尚未定义为静态,但正用作静态。

Notice: Class string not found. in /home/brando/public_html/wp-
content/plugins/ownapainting-shopping-cart/paypal/lib/PPXmlMessage.php on line 172

严格标准的另一个问题。

基本上为最后3个,更改E_STRICT |的错误报告E_ALL只是E_ALL。它不会解决问题,但它会阻止它们出现给客户。

最终解决方案是不使用PayPal SDK。不建议真的使用它。 SDK会导致更多问题。以下是我们在开始PayPal集成时给人们的一些入门信息。它应该有所帮助:

Getting Started: https://www.x.com/developers/paypal/documentation-tools/paypal-payments-pro/paypal-payments-pro-getting-started-guide 
API Reference Guide: https://www.x.com/developers/paypal/documentation-tools/api?qt-api_references=1#qt-api_references 
Sample Code: https://www.x.com/developers/paypal/documentation-tools/paypal-code-samples 

请使用NVP,而不是SOAP。 SOAP臃肿,完全没必要。