Partage
  • Partager sur Facebook
  • Partager sur Twitter

[Symfony] Kernel not found in appKernel

Erreur de démarage avec code du cours itération 5

    22 mai 2017 à 19:51:15

    Bonsoir !

    Je suis en train de faire le tutoriel sur Symfony 3 avec d'Alexandre Bacco. J'ai essayé de télécharger le code du prof mais je n'arrive pas à le lancer.

    Au départ je n'arrivais pas à lancer à cause d'une sorte d'absence du fichier autoload :

    :/var/www/mooc-symfony$ php bin/console server:start
    PHP Warning:  require(/var/www/mooc-symfony/app/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/mooc-symfony/app/autoload.php on line 11
    PHP Fatal error:  require(): Failed opening required '/var/www/mooc-symfony/app/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/mooc-symfony/app/autoload.php on line 11
    

    Du coup j'ai fait 'composer dump-autoload' mais je ne m'en suis pas tiré d'affaire pour autant :

    $ sudo composer dump-autoload
    [sudo] password for me: Generating autoload files /var/www/mooc-symfony$ php bin/console server:start PHP Fatal error: Class 'Symfony\Component\HttpKernel\Kernel' not found in /var/www/mooc-symfony/app/AppKernel.php on line 7

     Même en vidant le cache ça ne change rien. Pouvez-vous m'aider ?

    Voici mon fichier AppKernel.php :

    <?php
    // app/AppKernel.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 Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
                new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
                new AppBundle\AppBundle(),
                // Le générateur a généré la ligne suivante :
                new OC\PlatformBundle\OCPlatformBundle(),
            );
    
            if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
                $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
                $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
                $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
                $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            }
    
            return $bundles;
        }
    
        public function getRootDir()
        {
            return __DIR__;
        }
    
        public function getCacheDir()
        {
            return dirname(__DIR__).'/var/cache/'.$this->environment;
        }
    
        public function getLogDir()
        {
            return dirname(__DIR__).'/var/logs';
        }
    
        public function registerContainerConfiguration(LoaderInterface $loader)
        {
            $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
        }
    }

    J'ai alors tout recommencé et en suivant à la lettre les intstructions et j'ai une première erreur :

    antoine@antoine-Inspiron-3543:/var/www$ sudo git clone https://github.com/winzou/mooc-symfony.git
    Cloning into 'mooc-symfony'...
    remote: Counting objects: 811, done.
    remote: Total 811 (delta 0), reused 0 (delta 0), pack-reused 811
    Receiving objects: 100% (811/811), 150.75 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (321/321), done.
    Checking connectivity... done.
    antoine@antoine-Inspiron-3543:/var/www$ cd mooc-symfony/ && php composer.phar install
    Could not open input file: composer.phar
    

    Je télécharge alors composer :

    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    PHP Warning:  copy(composer-setup.php): failed to open stream: Permission denied in Command line code on line 1
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    Installer verified
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ php composer-setup.php
    All settings correct for using Composer
    The installation directory "/var/www/mooc-symfony" is not writable
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ sudo php composer-setup.php
    All settings correct for using Composer
    Downloading...
    
    Composer (version 1.4.2) successfully installed to: /var/www/mooc-symfony/composer.phar
    Use it: php composer.phar
    
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ php -r "unlink('composer-setup.php');"
    PHP Warning:  unlink(composer-setup.php): Permission denied in Command line code on line 1
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ sudo php -r "unlink('composer-setup.php');"
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ ls
    app  bin  composer.json  composer.lock  composer.phar  LICENSE  phpunit.xml.dist  README.md  src  tests  web
    antoine@antoine-Inspiron-3543:/var/www/mooc-symfony$ php composer.phar install
    Cannot create cache directory /home/antoine/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
    Cannot create cache directory /home/antoine/.composer/cache/files/, or directory is not writable. Proceeding without cache
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Package operations: 31 installs, 0 updates, 0 removals
    
                                                                             
      [RuntimeException]                                                     
      /var/www/mooc-symfony/vendor does not exist and could not be created.  
                                                                             
    
    install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
    



    Je ne me souviensplus de comment j'ai eu ma première erreur mais là j'ai plus de vendors. Que dois-je faire ?




    -
    Edité par antoinecompagnie 22 mai 2017 à 20:52:46

    • Partager sur Facebook
    • Partager sur Twitter
      23 mai 2017 à 14:25:38

      Salut un
      composer install

      et normalement c'est ok

      -
      Edité par heyden7611 23 mai 2017 à 14:26:06

      • Partager sur Facebook
      • Partager sur Twitter
        28 mai 2017 à 16:21:56

        Merci pour votre réponse ! Malheureusement après avoir renseigner quelques paramètres ça m'entraine l'erreur suivante à l'étape indiquée en première ligne :

        > Incenteev\ParameterHandler\ScriptHandler::buildParameters
        Script Incenteev\ParameterHandler\ScriptHandler::buildParameters handling the post-install-cmd event terminated with an exception [ErrorException] file_put_contents(app/config/parameters.yml): failed to open stream: Permission denied



        Et il semblerait que le faire avec `sudo` ne soit pas une bonne idée...

        -
        Edité par antoinecompagnie 28 mai 2017 à 16:23:16

        • Partager sur Facebook
        • Partager sur Twitter

        [Symfony] Kernel not found in appKernel

        × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
        × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
        • Editeur
        • Markdown