1

该项目在我的本地环境中运行,但是当我将它部署在共享 Web 服务器上时它不起作用。

Server
 /home
   /app
   /src
      /gestor
        /UsuarioBundle
        ...   
   /vendors
   ....
 /public_html
   /web
   app.php
   ...

如果我转到 host/app.php -> Fatal error:
Class 'Gestor\UsuarioBundle\UsuarioBundle' not found in /home/esdrhazc/app/AppKernel.php on line 19

应用内核.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 Gestor\UsuarioBundle\UsuarioBundle(),
            new Gestor\AdministracionBundle\AdministracionBundle(),
            new Gestor\ExpedientesBundle\ExpedientesBundle(),
            new Gestor\GestionBundle\GestionBundle(),
            new \Ideup\SimplePaginatorBundle\IdeupSimplePaginatorBundle(),
            new Gestor\MensajeBundle\MensajeBundle(),
            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');
    }
}

自动加载.php

use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;

/**
 * @var ClassLoader $loader
 */
$loader = require __DIR__.'/../vendor/autoload.php';

$loader->add('Gestor', __DIR__.'/../src');

AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

return $loader;

最后,例如,Usuario.php 类

namespace Gestor\UsuarioBundle\Entity;

...

class Usuario implements AdvancedUserInterface {...}

我已删除服务器/应用程序/缓存并授予权限。

提前致谢!!!

4

1 回答 1

4

将文件夹“gestor”更改为“Gestor”

于 2013-11-02T21:46:46.443 回答