2014-11-08 06:11 阅读 41


Asked Here but no proper response.

Hi, When I tried to use paypal sdk, and when I tried to submit the details, it is showing this error.

Fatal error: require(): Failed opening required '/home/wwwrapid/public_html/test/samples/vendor/paypal/paypal-merchant-sdk-php-4f570f5/lib/services/PayPalAPIInterfaceService/PayPalAPIInterfaceService.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wwwrapid/public_html/test/merchant-sdk-php-master/samples/PPAutoloader.php on line 451

When I go through the folders path, I dont find any folder named 'vendor'. I have been searching the solution for this for two days. Some sites say it's a composer error and installing composer solves the issue. and this is the code for that.

curl -sS | php
mv composer.phar /usr/local/bin/composer

My problem is I am not able to understand what they mean? I don't even know where to add this code? I mean in which file? How can that composer be installed on my site?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douao8204 douao8204 2014-11-08 06:56

    If you're on Windows the easiest thing to do is download the Windows installer and use it.

    In order for Composer to install, though, you're going to need PHP installed. The easiest way to do this is to just configure a local server setup using WAMP or something similar. You'll need do that prior to installing Composer.

    Once all of that is done you'll be able to utilize Composer to manage PHP packages within your projects. It's really pretty awesome stuff, but it can be a little confusing if you've never worked with it before.

    Basically, once it's installed, you can just create a composer.json file at your project root. This file is basically a config file that tells Composer what PHP packages you want to use (among other things.)

    For PayPal's SDK you could setup a composer.json file with nothing but this in it:

    "require": {
        "php": ">=5.3.0",
        "ext-curl": "*",
        "ext-json": "*",
        "paypal/rest-api-sdk-php" : "0.5.*"

    Then, from the command line, you can browse to the project root (where the composer.json file is) and run "composer update".

    This would look at the composer.json file and download any/all packages that are required based on that line. In this case it would be pulling in the PayPal REST API SDK, and then all of the samples that PayPal provides would work for you.

    Composer is what creates that /vendor directory and sets up an autoloader for you. Hope that helps.

    点赞 评论 复制链接分享