2015-02-10 6 views
11

için Symfony2 docs okudum Bir Symfony2 uygulamasını dağıtmak nasıl ama bazı sorunlar | uyarılarım var. here söylediği gibi ben ilk çalıştırdığınızda komut bu biridir:Symfony2 uygulamasını prod ortamına kur, post-install-cmd özel durumuna neden oluyor

kaldırma komutu
composer install --no-dev --optimize-autoloader 

| Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle silip ben konsolunda bu hata var: Bunlar, bu üzerinde yer alan dosyaların içeriğini olan

Generating optimized autoload files 
PHP Fatal error: Class 'Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle' not found in /var/www/sis-php-source/app/AppKernel.php on line 40 
PHP Stack trace: 
PHP 1. {main}() /var/www/sis-php-source/app/console:0 
PHP 2. Symfony\Component\Console\Application->run() /var/www/sis-php-source/app/console:28 
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /var/www/sis-php-source/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126 
PHP 4. Symfony\Component\HttpKernel\Kernel->boot() /var/www/sis-php-source/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70 
PHP 5. Symfony\Component\HttpKernel\Kernel->initializeBundles() /var/www/sis-php-source/app/bootstrap.php.cache:2343 
PHP 6. AppKernel->registerBundles() /var/www/sis-php-source/app/bootstrap.php.cache:2513 
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception 

[RuntimeException] 
    An error occurred when executing the "'cache:clear --no-warmup'" command. 

(composer.json ve AppKernel.php)

composer.json

{ 
    "name": "Sis-PHP-Sources", 
    "license": "MIT", 
    "type": "project", 
    "description": "Sis-PHP-Sources", 
    "autoload": { 
     "psr-4": { 
      "": "src/" 
     } 
    }, 
    "require": { 
     "php": ">=5.3.3", 
     "symfony/symfony": "~2.6", 
     "doctrine/orm": "~2.2,>=2.2.3", 
     "doctrine/doctrine-bundle": "~1.2", 
     "twig/extensions": "~1.0", 
     "symfony/assetic-bundle": "~2.3", 
     "symfony/swiftmailer-bundle": "~2.3", 
     "symfony/monolog-bundle": "~2.4", 
     "sensio/distribution-bundle": "~3.0", 
     "sensio/framework-extra-bundle": "~3.0", 
     "friendsofsymfony/user-bundle": "[email protected]", 
     "friendsofsymfony/jsrouting-bundle": "2.0.*@dev", 
     "friendsofsymfony/rest-bundle": "1.6.*@dev", 
     "jms/serializer-bundle": "0.13.*@dev", 
     "nelmio/api-doc-bundle": "2.7.*@dev", 
     "jms/di-extra-bundle": "1.5.*@dev", 
     "jms/security-extra-bundle": "dev-master", 
     "knplabs/knp-paginator-bundle": "2.4.*@dev", 
     "knplabs/knp-menu": "2.0.*@dev", 
     "knplabs/knp-menu-bundle": "2.0.*@dev", 
     "stof/doctrine-extensions-bundle": "1.2.*@dev", 
     "misd/phone-number-bundle": "~1.0", 
     "willdurand/js-translation-bundle": "2.2.0", 
     "vich/uploader-bundle": "1.0.*@dev", 
     "javiereguiluz/easyadmin-bundle": "dev-master" 
    }, 
    "require-dev": { 
     "sensio/generator-bundle": "~2.3" 
    }, 
    "scripts": { 
     "post-root-package-install": [ 
      "SymfonyStandard\\Composer::hookRootPackageInstall" 
     ], 
     "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", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles" 
     ], 
     "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", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles" 
     ] 
    }, 
    "config": { 
     "bin-dir": "bin" 
    }, 
    "extra": { 
     "symfony-app-dir": "app", 
     "symfony-web-dir": "web", 
     "branch-alias": { 
      "dev-master": "2.6-dev" 
     }, 
     "symfony-assets-install": "symlink" 
    } 
} 

AppKernel.php ben yanlış yapıyorum ne

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 Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 
      new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), 
      new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), 
      new FOS\UserBundle\FOSUserBundle(), 
      new FOS\JsRoutingBundle\FOSJsRoutingBundle(), 
      new Knp\Bundle\MenuBundle\KnpMenuBundle(), 
      new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), 
      new JMS\SerializerBundle\JMSSerializerBundle(), 
      new JMS\AopBundle\JMSAopBundle(), 
      new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), 
      new JMS\DiExtraBundle\JMSDiExtraBundle($this), 
      new Misd\PhoneNumberBundle\MisdPhoneNumberBundle(), 
      new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(), 
      new Vich\UploaderBundle\VichUploaderBundle(), 
      new JavierEguiluz\Bundle\EasyAdminBundle\EasyAdminBundle(), 
      #Sis-PHP Bundles 
      new AppBundle\AppBundle(), 
      new Sencamer\BackendBundle\BackendBundle(), 
     ); 

     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(); 
      $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 
     } 

     return $bundles; 
    } 

    public function registerContainerConfiguration(LoaderInterface $loader) 
    { 
     $loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml'); 
    } 

} 

? Symfony2 uygulamasını dağıtmanın doğru yolu bu mu? Bu sorunu nasıl giderebilirim?

+1

"composer.json" dosyanızı gönderiye ekleyebilir misiniz? – chapay

+0

@AndreySobkanyuk tamamlandı, ben 'composer.json' ve ayrıca 'AppKernel.php' ekledim – ReynierPM

cevap

18

the documentation page adresindeki bilgi kutusunu okudunuz mu? Bu adımda sırasında bir "sınıfı bulunamadı" hatası alırsanız post-install-cmd komut prod ortamda çalışacak şekilde

, bu komutu çalıştırmadan önce vadede export SYMFONY_ENV=prod gerekebilir.

+0

Eh, bu benim AppKernel.php' dosyamın nasıl göründüğüne benziyor, ben bu satırlara dokunmadım, ama meselenin orada olduğunu söylediğim gibi, bu komutları çalıştırmayı ve aynı problemin olup olmadığını bana söyler misiniz? Belki bir sorun ya da yanlış bir şey yapıyorum – ReynierPM

+0

Teşekkürler, bu sorunu düzeltildi ve hayır ben bu kutuyu atlamak, benim kötü – ReynierPM

+0

@AndreySobkanyuk Ben de aynı sorun olacağını düşünüyorum iyi bir fikir olduğunu düşünüyorum – ReynierPM

İlgili konular