【问题标题】:composer not loading class after moving folder移动文件夹后作曲家不加载类
【发布时间】:2019-02-15 23:01:32
【问题描述】:

我遇到了一个问题,我将整个文件夹移动到带有供应商文件和所有内容的服务器中,并且它不再加载类,而 localhost/本地副本工作正常。可能是什么问题? 错误代码是不必要的,但我还是要添加它..

致命错误:未捕获的错误:在 /home/user/full/path/of/the/file/where/its/located 中找不到类“Google_Service_Adsense”

文件没有改变,只是移动到服务器中。 Composer 不在服务器中,它是一个托管服务器,因此也无法安装和更新包或 composer。

composer.json:

{ "require": { "google/apiclient": "^2.0", "google/apiclient-services": "^0.68.0" } }

类文件所在的文件路径:

myDirectory\vendor\google\apiclient-services\src\Google\Service\AdSense.php

它实际驻留在 github 存储库中的链接:

https://github.com/google/google-api-php-client-services/blob/master/src/Google/Service/AdSense.php


更新: 从服务器删除整个内容并重新导入后,我收到此错误: Fatal error: require(): Failed opening required '/home/user/full/path/of/the/file/where/its/located/vendor/composer/../guzzlehttp/psr7/src/functions_include.php' (include_path='.:/usr/share/pear') in /home/user/full/path/of/the/file/where/its/located/vendor/composer/autoload_real.php on line 66


第二次更新。再次从服务器中删除包含内容的目录,上传压缩存档,解压缩后,我仍然遇到第一个致命错误。

【问题讨论】:

    标签: php class composer-php


    【解决方案1】:

    在为不同类型的文件上传和解压而苦苦挣扎之后,我手动加载了类所在的文件(尽管我认为我不需要这样做) 喜欢:

      require_once __DIR__ . '/vendor/google/apiclient-services/src/Google/Service/AdSense.php';
    

    它开始工作了。

    【讨论】:

      猜你喜欢
      • 2018-03-30
      • 2018-02-27
      • 2014-08-15
      • 1970-01-01
      • 2015-12-24
      • 2017-01-14
      • 2018-10-01
      • 2016-03-06
      相关资源
      最近更新 更多