本文介绍了Symfony异常(没有找到类)只在开发和生产服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Laravel 4项目只在生产和测试服务器上出现以下错误。一切都可以在本地机器上正常工作:

I am getting the following error in my Laravel 4 project ONLY on the production and testing servers. Everything works fine on my local machine:

{error:{type:Symfony\\\Component\\ Debug\\Exception\\FatalErrorException,message:ClassIntercom\\IntercomBasicAuthClient'not found,file:\ / www\ / htdocs\ / laravel\ /app\/ACME\/Services\/IntercomService.php,line:26}}

我试过一切!我甚至删除了composer.lock文件和整个供应商目录,并通过作曲家安装进行了全新的安装。没有任何帮助。

I have tried everything! I even deleted the composer.lock file and the whole vendor directory and did a fresh install via composer install. Nothing helped.

我运行 php artisan clear-compiler php artisan dump-autoload php artisan optimization ...没有任何帮助:(

I ran php artisan clear-compiled, php artisan dump-autoload and php artisan optimize ...nothing helped :(

在正确的位置,它在我的本地机器上工作得很好
该类也在IntercomService.php中完美引用,使用如下语句:

The class is physically in the right location and it works perfectly fine on my local machine.The class is also perfectly referenced in the IntercomService.php with a use statement like so:

使用Intercom\IntercomBasicAuthClient;

这是composer.json:

This is the composer.json:

{
name:laravel / laravel,
description:Laravel Framework,
keywords :[框架,laravel],
license:MIT,
repositories:[
{
type:vcs,
url:https://github.com/intercom/intercom-php
}
],
require:{
laravel / framework :4.2。*,
intercom / intercom-api-client:dev-master
},
autoload:{
classmap:[
app / commands,
app / controllers,
app / database / migrations
app / database / seeds,
app / tests / TestCase.php
],
psr-0:{
ACME: app
}
},
scripts:{
post-install-cmd:[
php artisan optimization
] ,
post-update-cmd:[
php artisan clear-compile,
php artisan optimization
],
post-create- project-cmd:[
php artisan key:generate
]
},
config:{
preferred-install:dist
},
minimum-stability:stable
}

推荐答案

我找到了解决方案!问题出现在Intercom PHP Package中。在包的src /文件夹中,他们正在以小写字母写入对讲机命名空间的文件夹:

I have found the solution! The problem was in the Intercom PHP Package. In the src/ folder of the package they were writing the folder of the intercom namespace in lowercase letters like so:

src/intercom/...

由于对讲机 t匹配命名空间对讲机它没有工作!

Since intercom doesn't match the namespace Intercom it didn't work!

然而,在我的本地Mac上它工作,因为我猜Mac是不区分大小写的,不在乎吗?

However, on my local Mac it did work, since I guess the Mac is case-insensitive and doesn't care?!

我一直在拉着我的头发,希望这可以帮助别人这样的问题。

I have been pulling my hair over this one and hope this helps others with this kind of issue...

确保您的命名空间与其所在的文件夹大小匹配。

这篇关于Symfony异常(没有找到类)只在开发和生产服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 15:51