dongou2019 2014-11-08 06:11
浏览 67
已采纳

PHP无法加载供应商文件夹:如何在我的服务器上安装composer?

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 https://getcomposer.org/installer | 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 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 通联支付网上收银统一下单接口
  • ¥15 angular有偿编写,
  • ¥15 centos7系统下abinit安装时make出错
  • ¥15 hbuildex运行微信小程序报错
  • ¥15 关于#python#的问题:我知道这个问题对你们来说肯定so easy
  • ¥15 wpf datagrid如何实现多层表头
  • ¥15 为啥画版图在Run DRC会出现Connect Error?可我Calibre的hostname和计算机的hostname已经设置成一样的了。
  • ¥20 网站后台使用极速模式非常的卡
  • ¥20 Keil uVision5创建project没反应
  • ¥15 mmseqs内存报错