Search code examples
phpsymfonydeploymentcapistranocapifony

how to deploy in debug mode a symfony2 app with capifony?


I have deployed my application on my website and it works finally just fine. However, I've made a second deployment with the multistage option of capifony, this one is called development as opposed to production.

Inside my development.rb file, I have set :

set :clear_controllers, false

so that the file app_dev.php does not get removed. Indeed it is available but it does not launch by default despite the following virtual host config:

<VirtualHost *:80>
    ServerName test.sebastienvassaux.com
    DocumentRoot /var/www/mysite.com/development/current/web

    DocumentRoot /var/www/mysite.com/development/current/web
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/mysite.com/development/current/web>
        DirectoryIndex app_dev.php
        Options -Indexes
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

So first question: how do I do for the mysite.com to load app_dev.php and not app.php ?

Then, if I manually enter the address mysite.com/app_dev.php, I get the following error :

ClassNotFoundException in AppKernel.php line 42: Attempted to load class "SensioGeneratorBundle" from namespace "Sensio\Bundle\GeneratorBundle". Did you forget a "use" statement for another namespace?

Well, this error is not raised when I work locally in dev mode, why is it raised here? What can I do to further understand the issue?

Thanks a lot!


Solution

  • The problem is that composer has a section require-dev that is not gathered or added to the autoloader.

    You can configure capifony to include the require-dev, prefrabily in you development.rb:

    set :composer_options,  "--dev --verbose --prefer-dist --optimize-autoloader --no-progress"
    

    In conjuntion with set :clear_controllers, false you should be able to run app_dev.php

    Hope that it helps