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.

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

报告相同问题?

悬赏问题

  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?