我知道这已被问过几次了,但我保证我已完成了我的研究。我已经在同一个问题上工作了大约10个小时,所以我必须遗漏一些东西。
尝试运行需要OpenSSL和PEAR的脚本。所以我下载了XSLP的OpenSSL版本并安装了它。我还添加了extension = php_openssl.dll并从网上安装了OpenSSL。
我的剧本:
<?php
// Include required library files.
require_once('includes/config.php');
require_once('includes/paypal.class.php');
// Create PayPal object.
$PayPalConfig = array('Sandbox' => $sandbox, 'APIUsername' => $api_username, 'APIPassword' => $api_password, 'APISignature' => $api_signature);
$PayPal = new PayPal($PayPalConfig);
// Prepare request arrays
$SetAccessPermissionsFields = array(
'ReturnURL' => '', // URL to return the browser to after authorizing permissions.
'CancelURL' => '', // URL to return if the customer cancels authorization
'LogoutURL' => '', // URL to return to on logout from PayPal
'LocalCode' => '', // Local of pages displayed by PayPal during authentication. AU, DE, FR, IT, GB, ES, US
'PageStyle' => '', // Sets the custom payment page style of the PayPal pages associated with this button/link.
'HDRIMG' => '', // URL for the iamge you want to appear at the top of the PayPal pages. 750x90. Should be stored on a secure server. 127 char max.
'HDRBorderColor' => '', // Sets the border color around the header on PayPal pages.HTML Hexadecimal value.
'HDRBackColor' => '', // Sets the background color for PayPal pages.
'PayFlowColor' => '', // Sets the background color for the payment page.
'InitFlowType' => '', // The initial flow type, which is one of the following: login / signup Default is login.
'FirstName' => '', // Customer's first name.
'LastName' => ''
);
$RequiredPermissions = array(
'Email',
'Name',
'GetBalance',
'RefundTransaction',
'GetTransactionDetails',
'TransactionSearch',
'MassPay',
'EncryptedWebsitePayments',
'GetExpressCheckoutDetails',
'SetExpressCheckout',
'DoExpressCheckoutPayment',
'DoCapture',
'DoAuthorization',
'DoReauthorization',
'DoVoid',
'DoDirectPayment',
'SetMobileCheckout',
'CreateMobileCheckout',
'DoMobileCheckoutPayment',
'DoUATPAuthorization',
'DoUATPExpressCheckoutPayment',
'GetBillingAgreementCustomerDetails',
'SetCustomerBillingAgreement',
'CreateBillingAgreement',
'BillAgreementUpdate',
'BillUser',
'DoReferenceTransaction',
'Express_Checkout',
'Admin_API',
'Auth_Settle',
'Transaction_History'
);
$OptionalPermissions = array(
'Email',
'Name',
'GetBalance',
'RefundTransaction',
'GetTransactionDetails',
'TransactionSearch',
'MassPay',
'EncryptedWebsitePayments',
'GetExpressCheckoutDetails',
'SetExpressCheckout',
'DoExpressCheckoutPayment',
'DoCapture',
'DoAuthorization',
'DoReauthorization',
'DoVoid',
'DoDirectPayment',
'SetMobileCheckout',
'CreateMobileCheckout',
'DoMobileCheckoutPayment',
'DoUATPAuthorization',
'DoUATPExpressCheckoutPayment',
'GetBillingAgreementCustomerDetails',
'SetCustomerBillingAgreement',
'CreateBillingAgreement',
'BillAgreementUpdate',
'BillUser',
'DoReferenceTransaction',
'Express_Checkout',
'Admin_API',
'Auth_Settle',
'Transaction_History'
);
$PayPalRequestData = array(
'SetAccessPermissionsFields' => $SetAccessPermissionsFields,
'RequiredPermissions' => $RequiredPermissions,
'OptionalPermissions' => $OptionalPermissions
);
$PayPalRequestData = array(
'SetAccessPermissionsFields' => $SetAccessPermissionsFields,
'RequiredPermissions' => $RequiredPermissions,
'OptionalPermissions' => $OptionalPermissions
);
// Pass data into class for processing with PayPal and load the response array into $PayPalResult
$PayPalResult = $PayPal->SetAccessPermissions($PayPalRequestData);
// Write the contents of the response array to the screen for demo purposes.
echo '<pre />';
print_r($PayPalResult);
?>
我的phpinfo()显示:
Apache Version Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
OPENSSL_CONF C:/xampp/apache/bin/openssl.cnf
SSL Version OpenSSL/1.0.1c
OpenSSL support enabled
OpenSSL Library Version OpenSSL 1.0.1c 10 May 2012
OpenSSL Header Version OpenSSL 0.9.8x 10 May 2012
所以,我认为我的OpenSSL配置得当。
至于梨......谁知道。运行我的脚本时,我得到以下内容:
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required 'C:/xampp/htdocs/SetAccessPermissions.php' (include_path='.;C:\xampp\php\PEAR') in Unknown on line 0
我已经读过这是一个权限问题,所以...我已经验证了对整个XAMPP目录的完全控制,对我的文件的完全控制,对OpenSSL和PEAR目录的完全控制以及我作为管理员运行XAMPP。
我有什么遗漏的吗?这变得非常令人沮丧!