Search code examples
phpapachesymfony1httpd.conf

symfony apache configuration error, controller not getting called


I configured my /etc/apache/httpd.conf as said in the getting started tutorial :

# 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>

I open localhost:8080 in web browser, it works fine. but when I try to open anything else like localhost:8080/poster , it throws a 404. And that's not a 404 redirected by symfony, it's the default one generated by apache! That means apache is not sending the request to my controller i.e. /var/www/innobo/web/index.php. I tried the same on another computer, it works fine. there the request reaches controller and everything works as expected. Where can the fault lie?


Solution

  • If app.php/poster is working, this could depend by a setting in settings.yml (guessing you are working with secure mode in backend side):

    prod:
      .settings:
        no_script_name:         false
    

    If this is the problem, you have to change to true the no_script_name parameter.

    I hope this can help you.