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

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?

图片转代码服务由CSDN问答提供 功能建议

被问及这里但没有正确的回应。

Hi,当我试图使用paypal sdk,当我尝试提交详细信息时,它显示此错误。

 致命错误:require():无法打开所需的'/ 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') 在/home/wwwrapid/public_html/test/merchant-sdk-php-master/samples/PPAutoloader.php第451行
   
 
 

当我浏览文件夹路径时 ,我没有找到任何名为'vendor'的文件夹。 我已经搜索了两天的解决方案。 一些网站称这是一个作曲家错误,安装作曲家解决了这个问题。 这就是代码。

  curl -sS https://getcomposer.org/installer |  php 
mv composer.phar / usr / local / bin / composer 
   
 
 

我的问题是我无法理解他们的意思? 我甚至不知道在哪里添加这段代码? 我的意思是在哪个档案? 如何在我的网站上安装该作曲家?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

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.

    点赞 评论

相关推荐 更多相似问题