0

I succeeded in install my application on a shared server with this tutorial. My problem is the level of assets. In my template I use my CSS like this:

    {% stylesheets '@FrontHomeBundle/Resources/public/css/style.css'
               '@FrontHomeBundle/Resources/public/css/960.css' combine=true filter='?yui_css' output='css/comingSoon.css' %}
     <link rel="stylesheet" type="text/css" media="screen" href="{{ asset_url }}"/>
    {% endstylesheets %}

same for the JS:

{% javascripts  'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'
                '@FrontHomeBundle/Resources/public/js/cufon-yui.js'
                '@FrontHomeBundle/Resources/public/js/Adobe_Caslon_Pro_600.font.js' filter='?yui_js' combine=true output='js/comingSoon.js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}

On my local server it works perfectly, but on my shared server I do not have access to the CSS and JS or images that are in the directory 'web / images /'.

I guess that is a .htaccess problem but I do not know what.

I put the config for assetics:

# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    # java: /usr/bin/java
    read_from: %kernel.root_dir%/../web
    write_to: %kernel.root_dir%/../web/cache
    filters:
        cssrewrite: ~
        # closure:
        #     jar: %kernel.root_dir%/java/compiler.jar
        yui_js:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar
        yui_css:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar

The .htaccess at the root of the project:

SetEnv SHORT_OPEN_TAGS 0
SetEnv REGISTER_GLOBALS 0
SetEnv MAGIC_QUOTES 0
SetEnv SESSION_AUTOSTART 0
SetEnv ZEND_OPTIMIZER 1
SetEnv PHP_VER 5_3
AddType x-mapp-php5 .php

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ web/app.php [QSA,L]
</IfModule>

The .htaccess in the web directory:

SetEnv SHORT_OPEN_TAGS 0
SetEnv REGISTER_GLOBALS 0
SetEnv MAGIC_QUOTES 0
SetEnv SESSION_AUTOSTART 0
SetEnv ZEND_OPTIMIZER 1
SetEnv PHP_VER 5_3
AddType x-mapp-php5 .php

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]

</IfModule>

Do you have a track to solve the problem? You on a shared server how do you to display images and CSS?

Thank you very much for your help

Gildas Ross
  • 3,812
  • 5
  • 21
  • 31
  • What do you mean by "I do not have access to the CSS and JS or images that are in the directory 'web / images /'." ? – Vitalii Zurian Aug 29 '12 at 15:21
  • I mean my CSS, JS and image files are not available. when I want to access it returns me a 404 – Gildas Ross Aug 29 '12 at 19:31
  • 1
    Did you dump the assets using `php app/console assets:install web --symlink` and `php app/console assetic:dump web` ? – AdrienBrault Aug 29 '12 at 19:51
  • The problem is that I am on a shared server so I haven't access to the console. – Gildas Ross Aug 29 '12 at 20:09
  • Should I dump the asset on my local server before commit? – Gildas Ross Aug 29 '12 at 20:11
  • 1
    See [this](http://stackoverflow.com/a/10253711/1218997) answer. – Mun Mun Das Aug 29 '12 at 22:00
  • @AdrienBrault I have an SSH access to my shared-server, I need just add `/usr/local/bin/php.TEST.5` before app/console to execute script with correct version of PHP @m2mdas thanks for your answer Now I can access to my JS an CSS files , but I still can't access my images are called in my template `{{ asset('images/pic.png') }}`, I tried `{{ asset('web/images/pic.png') }}` but I'm always redirected to `http://mydomain.com/images/pic.png` instead of `http://mydomain.com/web/images/pic.png` (address where my images are available). I think it's an .htaccess problem but I don't know what? – Gildas Ross Aug 30 '12 at 08:54

0 Answers0