title: symfony2 assets targets the /www server folder, not the /web symfony folder when deploy in production
body: <p>I have some problems with Symfony 2 application deployment. I have import all files I  need on my OVH shared server, but some errors occured like css and js files not found (internal server error for example) or error like <code>Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://my-server/css/458dafd_bootstrap-theme.min_1.css"</code>.</p>
  
  <p>Notice that I have installed the <a href="https://github.com/CoreSphere/ConsoleBundle" rel="nofollow noreferrer">CoresphereBundle</a> in order to have a console in my browser when my application is iploaded on my server, I have access to the console only on dev environment.</p>
  
  <p>This is step by step what I did in order to deploy my application:</p>
  
  <p><strong>1</strong> I updated my application and vendors with composer (because I have no ways to install composer on my server)</p>
  
  <pre><code>composer.phar update
  </code></pre>
  
  <p><strong>2</strong> I clear the dev cache <code>php app/console cache:clear</code></p>
  
  <p><strong>3</strong> I clear the prod cache <code>php app/console cache:clear --env=prod --no-debug</code></p>
  
  <p><strong>4</strong> I install assets <code>php app/console assets:install web</code></p>
  
  <p><strong>5</strong> I dump the assets <code>php app/console assetic:dump web</code></p>
  
  <p><strong>6</strong> I uploaded my symfony application on my server.</p>
  
  <p><strong>7</strong> Once the files are uploaded in <code>web/app.php</code> I I authorize
   the prod debug</p>
  
  <pre><code>$kernel = new AppKernel('prod', true);
  </code></pre>
  
  <p><strong>8</strong> Then in <code>web/config.php</code> I remove this block</p>
  
  <pre><code>// …
  
  if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
    '127.0.0.1',
    '::1',
  ))) {
    header('HTTP/1.0 403 Forbidden');
    exit('This script is only accessible from localhost.');
  }
  </code></pre>
  
  <p>So, on my server, if I would like to go to <code>http://my-server/web/config.php</code> it works well, so I see if my server is compatible with symfony. the only thing that appears is <code>Set short_open_tag to off in php.ini*.</code> </p>
  
  <p><strong>9</strong> I set the access rights for the <code>app/cache</code> and <code>app/log</code> folders to <strong>777</strong> on my server, it allows the applications to write in these folders.</p>
  
  <p><strong>10</strong> In <code>web/app_dev.php</code> I write this code, in order to allow the dev mode for my IP adress and so have access to the console bundle</p>
  
  <pre><code>// …
  
  if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
    '127.0.0.1',
    '::1',
    '121.457.719.2' //a random ip adress it's just for you to understand
  ))) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
  }
  </code></pre>
  
  <p><strong>11</strong> So I have access to the dev environment on my server, all works well, and no errors occured here. To access to the console bundle, following to the bundle documentation, I have to wrote  <code>http://my-server/web/app_dev.php/_console</code> (see the routing code here):</p>
  
  <pre><code>_console:
      resource: "@CoreSphereConsoleBundle/Resources/config/routing.yml"
      prefix: /_console
  </code></pre>
  
  <p>But this routes does not exist, If I wrote this url, nothing appear in my browser: <a href="https://i.stack.imgur.com/OPUTK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OPUTK.png" alt="enter image description here"></a></p>
  
  <p>However, by the <code>config.php</code>, I have access to <code>app_dev.php</code> by following the <code>Bypass configuration and go to the Welcome page</code> link:</p>
  
  <p><a href="https://i.stack.imgur.com/JU7f1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JU7f1.png" alt="enter image description here"></a></p>
  
  <p>I click on the link and I arrived on <code>app_dev.php</code>. Like I said before, no errors occured in this environment, except for the console route. But I could have access to the console by clicking on the console logo under the symfony debug toolbar:
  <a href="https://i.stack.imgur.com/fPEb1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fPEb1.png" alt="enter image description here"></a></p>
  
  <p>This is the url for the console when I click on the logo under symfony debug toolbar: <code>http://my-server/web/app_dev.php//_console/_console</code>, I would like to understand why?</p>
  
  <p>Then when I would like to make some commands another error occured: <code>[error] Internal Server Error</code> in the console:
  <a href="https://i.stack.imgur.com/Gvwuq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gvwuq.png" alt="enter image description here"></a></p>
  
  <p>If I try to use the router debug <code>php app/console debug:router</code>, I have this:
  <a href="https://i.stack.imgur.com/9CeB3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9CeB3.png" alt="enter image description here"></a></p>
  
  <p>and with the <code>php app/console debug:router | grep _console</code>:
  <a href="https://i.stack.imgur.com/1wObP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1wObP.png" alt="enter image description here"></a></p>
  
  <p>So, there are the problems I have with my symfony application.</p>
  
  <hr>
  
  <p>UPDATE</p>
  
  <p>I resolved the problem of the console bundle. In fact my server does not use the same php version of my symfony application, I have to set this in the <code>.ovhconfig</code> at the root of my <code>/www</code> folder.
  <code>/www/.ovhconfig</code>:</p>
  
  <pre><code>app.engine=php
  app.engine.version=5.5
  http.firewall=none
  environment=production
  </code></pre>
  
  <p>Now when I would like to access to the production environment I have these errors concerning all my assets files (<strong>css/js/images</strong>, a 404 not found):</p>
  
  <blockquote>
    <p>Failed to load resource: the server responded with a status of 404 (Not Found) -> <code>http://my-server.com/bundles/fosjsrouting/js/router.js</code></p>
    
    <p>Uncaught ReferenceError: fos is not defined -> routing:1 </p>
    
    <p>Failed to load resource: the server responded with a status of 404 (Not Found)
    -><code>http://my-server.com/css/45898d_dataTables.min_7.css</code></p>
  </blockquote>
  
  <p>I don't really understand, the files are indeed at the root of the app, e-g I have no folder css or js or etc in <code>http://my-server.com/</code>. These folders are in <code>http://my-server.com/web/</code>. Where is the problem?</p>
  
  <p>When I access to the console, this is the command I made:</p>
  
  <p>1 <code>cache:clear</code></p>
  
  <p>2 <code>assets:install web</code></p>
  
  <p>3 <code>assetic:dump web</code></p>
  
  <hr>
  
  <p>EDIT: solution works</p>
  
  <p>I understand that the assets target a <code>/css</code> <code>/js</code> <code>/images</code> etc folder at the root of my server, so I replace the css and js files to the root of the <code>/www</code> server folder, e-g in the <code>/www</code> folder of my server I have this:</p>
  
  <pre><code>//my server
    /.ssh
    /www /*http://my-server.com/...*/
      /app/
      /bin/
      /css/
      /fonts/
      /images/
      /js/
      /src/
      /vendor/
      /web/
      /.htaccess
      /.ovhconfig
      /composer.json
      /composer.lock
      /composer.phar
  </code></pre>
  
  <p>Why my symfony application tagets the assets here?</p>