我正在尝试使用PayPal Adaptive Payments SDK的PHP版本,并且在include_paths和class-not-found错误方面遇到巨大困难。
我用:
- Windows7
- Bitnami MediaWiki stack, v1.25.1-0
- PHP v5.5.25
- Apache v2.4.12
- PayPal AdaptivePaymentSdk 3.6.106
sdk获取路径:
- https://github.com/paypal/adaptivepayments-sdk-php/tree/namespace-php5.3
我的文档根目录,因此被称为'$IP',是:
- 'C:/Bitnami/mediawiki-1.25.1-0/apps/mediawiki/htdocs/'
SDK部署在文档根目录下,即
- $IP/adaptivepayments-sdk-php/...
我的include_path是一种绝望的行为,试图包含到所需PHP文件的所有可能路径。为提高可读性添加了换行符:
include_path = ".;
C:BitNamimediawiki-1.25.1-0phpPEAR;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendor;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypaladaptivepayments-sdk-phplib;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypaladaptivepayments-sdk-phplibPayPalService;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypaladaptivepayments-sdk-phplibPayPalTypesAP;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypaladaptivepayments-sdk-phplibPayPalTypesCommon;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplib;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalAuth;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalAuthOauth;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalAuthOpenid;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalCommon;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalCore;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalException;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalFormatter;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalHandler;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalIPN;
C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypalsdk-core-phplibPayPalTransport
"
我得到错误:
Fatal error: Class 'PayPalCorePPBaseService' not found in C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypaladaptivepayments-sdk-phplibPayPalServiceAdaptivePaymentsService.php on line 27
请注意,类'PayPalCorePPBaseService' 应该通过上面列出的以下include_path条目中的一个或两个可访问:
- C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypaladaptivepayments-sdk-phplib;
- C:Bitnamimediawiki-1.25.1-0appsmediawikihtdocsadaptivepayments-sdk-phpvendorpaypaladaptivepayments-sdk-phplibPayPalTypesCommon;
但是我得到了class-not-found错误。我在网上看到这个问题被提到过几次,但没有提供有效的解决方案。
类不能找到'PayPalCorePPBaseService'(这是ActivePaymentsService.php)有多个版本:
- $IP/vendorpaypaladaptivepayments-sdk-phplibPayPalServiceAdaptivePaymentsService.php
- $IP/adaptivepayments-sdk-php/lib/services/ActivePaymentsService.php
我在我的'require'语句中指定了第一个,但我实际上不知道应该使用哪个。我两个都试过了,都得到了相同的错误。
未找到的类"PPBaseService"驻留在"$IPadaptivepayments-sdk-phpvendorpaypalsdk-core-phplib paypal Core"中,并有一个指定的命名空间:
namespace PayPalCore;
.
.
class PPBaseService {
The class AdaptivePaymentsService also has a namespace specified:
namespace PayPalService;
.
.
use PayPalCorePPBaseService;
.
.
class AdaptivePaymentsService extends PPBaseService {
我对PHP名称空间或它们的含义或要求一无所知。特别是,我不明白是否/为什么两个命名空间都相对于路径"$IP/adaptivepayments-sdk-php/vendor/paypal/sdk-core-php/lib/"。
更基本的是,我不知道为什么我的include_path没有捕获/覆盖SDK中的每个类!
我的调用类是:
$IP/skins/Vector/VectorTemplate.php
在文件的开头我指定:
- require("vendor/autoload.php");
- require_once("adaptivepayments-sdk-php/vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Service/AdaptivePaymentsService.php");
当这些语句执行时,我得到'Class not found'错误。
我完全被难住了。如有任何帮助,不胜感激。谢谢,肖恩。
对于那些不熟悉自适应支付SDK树的人:
.:
CHANGELOG.md
LICENSE.txt
README.md
composer.json
composer.lock
lib/
list.txt
samples/
vendor/
./lib:
services/
./lib/services:
AdaptivePayments/
./lib/services/AdaptivePayments:
AdaptivePayments.php
AdaptivePaymentsService.php
./samples:
CancelPreapproval.php
CancelPreapprovalReceipt.php
Common/
Configuration.php
ConfirmPreapproval.php
ConfirmPreapprovalReceipt.php
ConvertCurrency.php
ConvertCurrencyReceipt.php
ExecutePayment.php
ExecutePaymentReceipt.php
GetAllowedFundingSources.php
GetAllowedFundingSourcesReceipt.php
GetAvailableShippingAddresses.php
GetAvailableShippingAddressesReceipt.php
GetFundingPlans.php
GetFundingPlansReceipt.php
GetPaymentOptions.php
GetPaymentOptionsReceipt.php
GetShippingAddresses.php
GetShippingAddressesReceipt.php
GetUserLimits.php
GetUserLimitsReceipt.php
IPN/
PPBootStrap.php
Pay.php
PayReceipt.php
PaymentDetails.php
PaymentDetailsReceipt.php
Preapproval.php
PreapprovalDetails.php
PreapprovalDetailsReceipt.php
PreapprovalReceipt.php
Refund.php
RefundReceipt.php
SetPaymentOptions.php
SetPaymentOptionsReceipt.php
ShowAllResponse.php
SimpleSamples/
WebflowReturnPage.php
cert_key.pem
composer.json
index.php
install.php
./samples/Common:
Calls.php
Constants.php
Error.php
Response.php
jquery-1.3.2.min.js
jquery.qtip-1.0.0-rc3.min.js
jquery.qtip-1.0.0-rc3.min.txt
menu.html
sdk.css
sdk_functions.js
style.css
tooltip.js
./samples/IPN:
IPN-README.md
IPNListener.php
./samples/SimpleSamples:
ChainedPay.html.php
ChainedPay.php
DelayedChainedPay.html.php
DelayedChainedPay.php
EmbeddedPay.html.php
EmbeddedPay.php
ParallelPay.html.php
ParallelPay.php
Preapproval.html.php
Preapproval.php
SimplePay.html.php
SimplePay.php
./vendor:
autoload.php
composer/
paypal/
./vendor/composer:
ClassLoader.php
LICENSE
autoload_classmap.php
autoload_namespaces.php
autoload_psr4.php
autoload_real.php
installed.json
./vendor/paypal:
adaptivepayments-sdk-php/
sdk-core-php/
./vendor/paypal/adaptivepayments-sdk-php:
CHANGELOG.md
LICENSE.txt
README.md
composer.json
lib/
samples/
./vendor/paypal/adaptivepayments-sdk-php/lib:
PayPal/
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal:
Service/
Types/
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Service:
AdaptivePaymentsService.php
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Types:
AP/
Common/
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Types/AP:
Address.php
AddressList.php
CancelPreapprovalRequest.php
CancelPreapprovalResponse.php
ConfirmPreapprovalRequest.php
ConfirmPreapprovalResponse.php
ConversionRate.php
ConvertCurrencyRequest.php
ConvertCurrencyResponse.php
CurrencyCodeList.php
CurrencyConversion.php
CurrencyConversionList.php
CurrencyConversionTable.php
CurrencyList.php
DisplayOptions.php
ErrorList.php
ExecutePaymentRequest.php
ExecutePaymentResponse.php
FeeDisclosure.php
FundingConstraint.php
FundingPlan.php
FundingPlanCharge.php
FundingSource.php
FundingTypeInfo.php
FundingTypeList.php
GetAllowedFundingSourcesRequest.php
GetAllowedFundingSourcesResponse.php
GetAvailableShippingAddressesRequest.php
GetAvailableShippingAddressesResponse.php
GetFundingPlansRequest.php
GetFundingPlansResponse.php
GetPaymentOptionsRequest.php
GetPaymentOptionsResponse.php
GetPrePaymentDisclosureRequest.php
GetPrePaymentDisclosureResponse.php
GetShippingAddressesRequest.php
GetShippingAddressesResponse.php
GetUserLimitsRequest.php
GetUserLimitsResponse.php
InitiatingEntity.php
InstitutionCustomer.php
InvoiceData.php
InvoiceItem.php
PayError.php
PayErrorList.php
PayRequest.php
PayResponse.php
PaymentDetailsRequest.php
PaymentDetailsResponse.php
PaymentInfo.php
PaymentInfoList.php
PhoneNumber.php
PostPaymentDisclosure.php
PostPaymentDisclosureList.php
PreapprovalDetailsRequest.php
PreapprovalDetailsResponse.php
PreapprovalRequest.php
PreapprovalResponse.php
Receiver.php
ReceiverDisclosure.php
ReceiverDisclosureList.php
ReceiverIdentifier.php
ReceiverInfo.php
ReceiverInfoList.php
ReceiverList.php
ReceiverOptions.php
RefundInfo.php
RefundInfoList.php
RefundRequest.php
RefundResponse.php
SenderDisclosure.php
SenderIdentifier.php
SenderOptions.php
SetPaymentOptionsRequest.php
SetPaymentOptionsResponse.php
ShippingAddressInfo.php
TaxIdDetails.php
UserLimit.php
WarningData.php
WarningDataList.php
./vendor/paypal/adaptivepayments-sdk-php/lib/PayPal/Types/Common:
AccountIdentifier.php
BaseAddress.php
ClientDetailsType.php
CurrencyType.php
ErrorData.php
ErrorParameter.php
FaultMessage.php
PhoneNumberType.php
RequestEnvelope.php
ResponseEnvelope.php
./vendor/paypal/adaptivepayments-sdk-php/samples:
CancelPreapproval.php
CancelPreapprovalReceipt.php
Common/
Configuration.php
ConfirmPreapproval.php
ConfirmPreapprovalReceipt.php
ConvertCurrency.php
ConvertCurrencyReceipt.php
ExecutePayment.php
ExecutePaymentReceipt.php
GetAllowedFundingSources.php
GetAllowedFundingSourcesReceipt.php
GetAvailableShippingAddresses.php
GetAvailableShippingAddressesReceipt.php
GetFundingPlans.php
GetFundingPlansReceipt.php
GetPaymentOptions.php
GetPaymentOptionsReceipt.php
GetShippingAddresses.php
GetShippingAddressesReceipt.php
GetUserLimits.php
GetUserLimitsReceipt.php
IPN/
PPBootStrap.php
Pay.php
PayReceipt.php
PaymentDetails.php
PaymentDetailsReceipt.php
Preapproval.php
PreapprovalDetails.php
PreapprovalDetailsReceipt.php
PreapprovalReceipt.php
Refund.php
RefundReceipt.php
SetPaymentOptions.php
SetPaymentOptionsReceipt.php
ShowAllResponse.php
WebflowReturnPage.php
cert_key.pem
composer.json
index.php
./vendor/paypal/adaptivepayments-sdk-php/samples/Common:
Calls.php
Constants.php
Error.php
Response.php
jquery-1.3.2.min.js
jquery.qtip-1.0.0-rc3.min.js
jquery.qtip-1.0.0-rc3.min.txt
menu.html
sdk.css
sdk_functions.js
style.css
tooltip.js
./vendor/paypal/adaptivepayments-sdk-php/samples/IPN:
IPN-README.md
IPNListener.php
./vendor/paypal/sdk-core-php:
CHANGELOG.md
LICENSE.txt
README.md
build.xml
composer.json
lib/
tests/
./vendor/paypal/sdk-core-php/lib:
PayPal/
./vendor/paypal/sdk-core-php/lib/PayPal:
Auth/
Common/
Core/
Exception/
Formatter/
Handler/
IPN/
Transport/
./vendor/paypal/sdk-core-php/lib/PayPal/Auth:
IPPCredential.php
IPPThirdPartyAuthorization.php
Oauth/
Openid/
PPCertificateCredential.php
PPSignatureCredential.php
PPSubjectAuthorization.php
PPTokenAuthorization.php
./vendor/paypal/sdk-core-php/lib/PayPal/Auth/Oauth:
AuthSignature.php
MockOAuthDataStore.php
OAuthConsumer.php
OAuthDataStore.php
OAuthRequest.php
OAuthServer.php
OAuthSignatureMethod.php
OAuthSignatureMethodHmacSha1.php
OAuthSignatureMethodPLAINTEXT.php
OAuthSignatureMethodRsaSha1.php
OAuthToken.php
OAuthUtil.php
./vendor/paypal/sdk-core-php/lib/PayPal/Auth/Openid:
PPOpenIdAddress.php
PPOpenIdError.php
PPOpenIdSession.php
PPOpenIdTokeninfo.php
PPOpenIdUserinfo.php
./vendor/paypal/sdk-core-php/lib/PayPal/Common:
PPApiContext.php
PPArrayUtil.php
PPModel.php
PPReflectionUtil.php
PPUserAgent.php
./vendor/paypal/sdk-core-php/lib/PayPal/Core:
PPAPIService.php
PPBaseService.php
PPConfigManager.php
PPConnectionManager.php
PPConstants.php
PPCredentialManager.php
PPHttpConfig.php
PPHttpConnection.php
PPLoggingManager.php
PPMessage.php
PPRequest.php
PPUtils.php
PPXmlMessage.php
cacert.pem
./vendor/paypal/sdk-core-php/lib/PayPal/Exception:
OAuthException.php
PPConfigurationException.php
PPConnectionException.php
PPInvalidCredentialException.php
PPMissingCredentialException.php
PPTransformerException.php
./vendor/paypal/sdk-core-php/lib/PayPal/Formatter:
FormatterFactory.php
IPPFormatter.php
PPNVPFormatter.php
PPSOAPFormatter.php
./vendor/paypal/sdk-core-php/lib/PayPal/Handler:
IPPHandler.php
PPAuthenticationHandler.php
PPCertificateAuthHandler.php
PPGenericServiceHandler.php
PPMerchantServiceHandler.php
PPOpenIdHandler.php
PPPlatformServiceHandler.php
PPSignatureAuthHandler.php
./vendor/paypal/sdk-core-php/lib/PayPal/IPN:
PPIPNMessage.php
./vendor/paypal/sdk-core-php/lib/PayPal/Transport:
PPRestCall.php
./vendor/paypal/sdk-core-php/tests:
Openid/
PPAPIServiceTest.php
PPBaseServiceTest.php
PPBootStrap.php
PPCertificateCredentialTest.php
PPConfigManagerTest.php
PPConfigurationExceptionTest.php
PPConnectionExceptionTest.php
PPConnectionManagerTest.php
PPCredentialManagerTest.php
PPIPNMessageTest.php
PPInvalidCredentialExceptionTest.php
PPLoggingManagerTest.php
PPMessageTest.php
PPMissingCredentialExceptionTest.php
PPSignatureCredentialTest.php
PPUtilsTest.php
sdk_config.ini
./vendor/paypal/sdk-core-php/tests/Openid:
PPOpenIdAddressTest.php
PPOpenIdSessionTest.php
PPOpenIdTokeninfoTest.php
PPOpenIdUserinfoTest.php
对于Adaptive sdk,您需要确保您也安装了Core库:https://github.com/paypal/sdk-core-php