symfony apache配置错误,未调用控制器


symfony apache configuration error, controller not getting called

我按照getting started教程中的说明配置了/etc/apache/httpd.conf

# 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 "/var/www/innobo/web"
  DirectoryIndex index.php
  <Directory "/var/www/innobo/web">
    AllowOverride All
    Allow from All
  </Directory>
  Alias /sf /var/www/symfony/data/web/sf
  <Directory "/var/www/symfony/data/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
 Alias /uploads /var/www/innobo/web/uploads
  <Directory "/var/www/innobo/web/uploads">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

我在web浏览器中打开localhost:8080,它运行良好。但当我尝试打开任何其他类似localhost:8080/poster的东西时,它会抛出一个404。这不是symfony重定向的404,而是apache生成的默认404!这意味着apache没有向我的控制器(即/var/www/innobo/web/index.php)发送请求。我在另一台电脑上试过同样的方法,效果很好。在那里,请求到达控制器,一切都按预期进行。哪里有错?

如果app.php/poster正在工作,这可能取决于settings.yml中的设置(猜测您在后端使用安全模式):

prod:
  .settings:
    no_script_name:         false

如果这是问题所在,则必须将no_script_name参数更改为true

我希望这能帮助你。

听起来mod_rewrite没有打开/工作。尝试localhost:8080/app.php/poster

您还应该运行symfony检查脚本。默认情况下,您可以找到它/web/config.php,因此您应该能够通过将localhost:8080/config.php放入浏览器

来访问它