Error getting images to show up in Symfony 1.4.8

心已入冬 提交于 2019-12-11 02:07:53

问题


Note: It was tough deciding whether this belonged here or ServerFault, but it seemed like a programming problem, so if it's out of place, feel free to migrate it.

I downloaded the sandbox of Symfony 1.4.8 and copied the files to my webserver. Unfortunately, when I try to access /symfony/sf_sandbox/web/ (where I installed it), I get the following:

It seems like the images aren't showing. According to the text:

If you see no image in this page, you may need to configure your web server so that it gains access to the symfony_data/web/sf/ directory.

However, when I try to locate the folder referenced above, it does not exist:

  sf_sandbox
    web
      css/
      images/
      js/
      uploads/
      frontend_dev.php
      index.php
      robots.txt

As you can see, there is no sf/ directory under web/. What am I doing wrong?

Note: I am installing this on Ubuntu 10.04 64-bit using Apache.


回答1:


All the images are located in the Symfony source directory.

I would try creating a symbolic link in the web folder called sf pointed to the following: lib\vendor\symfony\data\web\sf

It should have access to the needed images at that point.




回答2:


This is done by indicating the right path in the Alias directive in your apache configuration:

# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:8080

# This is the configuration for your project
Listen 127.0.0.1:8080

<VirtualHost 127.0.0.1:8080>
  DocumentRoot "/home/sfprojects/jobeet/web"
  DirectoryIndex index.php
  <Directory "/home/sfprojects/jobeet/web">
    AllowOverride All
    Allow from All
  </Directory>

  Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
  <Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

Just replace "/home/sfprojects/jobeet" with your project's path and it should work.




回答3:


This page shows the apache config to set up a new project correctly. There are also important security notes for your webapp.

Symfony Documentation




回答4:


All you need to do is copy the whole sf folder to the web folder. In my case i copied c:\wamp\www\jobeet\lib\vendor\symfony\data\web\sf\ to c:\wamp\www\jobeet\web. Hope that makes sense



来源:https://stackoverflow.com/questions/3796583/error-getting-images-to-show-up-in-symfony-1-4-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!