【发布时间】:2012-09-28 23:06:50
【问题描述】:
我正在 Symfony 2.1 中创建新项目。我想检查我的应用程序是否会在我的服务器上正常运行,所以我复制了所有文件,清除了缓存并设置了权限。 在本地开发环境中一切正常,但是当我在我的服务器上请求“在线 - 产品”版本时出现错误:
Fatal error: Class 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' not found in /www/gastlich_www/www/livescore.gastlich.iq.pl/app/AppKernel.php on line 25
我找到了一些关于这个问题的信息,但它们都与将命名空间从 Symfony\Bundle 更改为 Doctrine\Bundle 和 Symfony 2.0 相关。
所以我检查了我的 AppKernel.php 文件,我的包路径是正确的。
我的 composer.json 看起来像:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"stof/doctrine-extensions-bundle": "dev-master",
"doctrine/doctrine-fixtures-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}
以及AppKernel.php的配置:
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\AopBundle\JMSAopBundle(),
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new Acme\StoreBundle\AcmeStoreBundle(),
new Livescore\StatsBundle\LivescoreStatsBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle()
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
我试图找出问题出在哪里,所以我在 AppKernel.php 中删除了这个包,然后我得到了下一个致命错误:
Fatal error: Class 'Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle' not found in /www/gastlich_www/www/livescore.gastlich.iq.pl/app/AppKernel.php on line 24
所以我假设,我对最后 2 个捆绑包只有问题:StofDoctrineExtensionsBundle 和 DoctrineFixturesBundle,它们在 composer.json 中有 dev-master 版本。在这一点上,我没有任何进一步的想法。我试图用谷歌搜索这个问题,但 90% 的问题与 Symfony 2.0 和移动 git 存储库有关;/
本地开发环境: PHP 5.4.6 mysql 5.5.27 Apache 2.2.22 (Fedora)
还有我的服务器环境: PHP 5.4.6 MySql 5.0.32
任何帮助将不胜感激。
谢谢!
【问题讨论】:
-
这个文件(带有 DoctrineFixturesBundle 类)物理上是否存在?尝试运行:php composer.phar update,看看问题是否仍然存在
-
嗨,我运行了 compser.phar 更新,但出现“源目录有未提交的更改”的一些错误。所以我删除了这些有冲突的供应商,一切都很顺利。脚本没有更新任何fixtures/stof bundle。下一步是将更改复制到在线服务器,我复制了整个应用程序目录。删除缓存后,我的应用程序在在线服务器上运行良好,我不知道问题出在哪里;/ 感谢您的帮助和建议 :)
标签: symfony production-environment classnotfoundexception fatal-error