Question

I'm having an issue whenever I try to log in, however this issue occurs only with the a Ubuntu Server where the site is uploaded and using wamp on windows works just fine.

I had no idea what's wrong with it. I don't see anything on the log file.

Here's the security.yml file:

security:
    encoders:
        Op\AppSecurityBundle\Entity\User: sha512
        Symfony\Component\Security\Core\User\User: plaintext

providers:
    default:
        entity: { class: AppSecurityBundle:User, property: email }

role_hierarchy:
    ROLE_OPTIME_ADMIN:  ROLE_OPT_USER
    ROLE_SUPER_ADMIN:   [ROLE_OPT_USER, ROLE_OPT_ADMIN, ROLE_ALLOWED_TO_SWITCH]

firewalls:
    dev:
        pattern:  ^/(_(profiler|wdt)|css|images|js)/
        security: false

    prizes:
        pattern:    ^/admin|^/security|^/landing|^/reports|^/catalog
        form_login:
            check_path: /security/login_check
            login_path: /
            provider: default
            success_handler: whos_online
            failure_handler: whos_online
        logout:
            path:   /security/logout
            target: /
            success_handler: whos_online

access_control:
    - { path: ^/admin, roles: [ROLE_OPT_ADMIN] }
    - { path: ^/security, roles: [ROLE_OPT_ADMIN, ROLE_OPT_USER] }
    - { path: ^/landing, roles: [ROLE_OPT_ADMIN, ROLE_OPT_USER] }
    - { path: ^/reports, roles: [ROLE_OPT_ADMIN, ROLE_OPT_USER] }
    - { path: ^/catalog, roles: [ROLE_OPT_ADMIN] }

routing_dev.yml

_assetic:
    resource: .
    type:     assetic

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

_main:
    resource: routing.yml

routing.yml

ws:
    resource: "@BeSimpleSoapBundle/Resources/config/routing/webservicecontroller.xml"
    prefix:   /ws

security:
    resource: @AppSecurityBundle/Resources/config/routing.yml

parameter:
    resource: @ParameterBundle/Resources/config/routing.yml

status:
    resource: @AppStatusBundle/Resources/config/routing.yml

csc:
    resource: @CSCBundle/Resources/config/routing.yml

catalog:
    resource: @CatalogBundle/Resources/config/routing.yml

prizes:
    resource: @PrizesBundle/Resources/config/routing.yml

reports:
    resource: @ReportsBundle/Resources/config/routing.yml

AppSecurityBundle/Resources/config/routing.yml

_security:
    resource: "@AppSecurityBundle/Controller/AppSecurityController.php"
    type:     annotation

Annotations in AppSecurityController.php

            /**
     * @Route("/", name="_login")
     * @Template()
     */
    public function loginAction( )
    {
         //hidden
        }

/**
     * @Route("/security/login_check", name="_security_check")
     */
    public function securityCheckAction( )
    {
        // The security layer will intercept this request
    }

    /**
     * @Route("/security/logout", name="_logout")
     */
    public function logoutAction( )
    {
        // The security layer will intercept this request
    }

    /**
     * @Route("/landing", name="_landing")
     * @Template()
     */
    public function landingAction( )
    {
        return array ( );
    }

I apologize if this is a stupid question. I have no idea why it works locally but not on the server.

I'm using Symfony 2.0.12, and Ubuntu Server 11.10

Added: When I run php app/console router:debug I get

[router] Current routes
Name                     Method Pattern
_wdt                     ANY    /_wdt/{token}
_profiler_search         ANY    /_profiler/search
_profiler_purge          ANY    /_profiler/purge
_profiler_import         ANY    /_profiler/import
_profiler_export         ANY    /_profiler/export/{token}.txt
_profiler_search_results ANY    /_profiler/{token}/search/results
_profiler                ANY    /_profiler/{token}
_webservice_call         POST   /ws/{webservice}
_webservice_definition   GET    /ws/{webservice}
_login                   ANY    /
_security_check          ANY    /security/login_check
_logout                  ANY    /security/logout
_landing                 ANY    /landing
_concurrency             ANY    /security/concurrency
_overwriteConcurrency    ANY    /security/overwriteConcurrency
_loading                 ANY    /security/loading
_changeLanguage          ANY    /changeLanguage
_security                ANY    /security/{strategy}/{globalStrategy}
_parameter               ANY    /admin/{strategy}/{globalStrategy}
_status                  ANY    /admin/{strategy}/{globalStrategy}
_csc                     ANY    /admin/{strategy}/{globalStrategy}
_catalogs                ANY    /catalog/{strategy}/{globalStrategy}
_prizes                  ANY    /admin/{strategy}/{globalStrategy}
_reports                 ANY    /{globalStrategy}/{strategy}
Was it helpful?

Solution

had the same issue once, in my case i didnt have my server well configured, i fix it by configuring apache2 with the rewrite module, in linux it should by sometinhg like this sudo a2enmod rewrite, pluss in your site configuration site in etc/apache/sites-available/example.dev you should have something like this

NameVirtualHost 127.0.0.1

<VirtualHost 127.0.0.1>
  ServerName example.dev
  DocumentRoot "/var/www/intranetcms/web"
  DirectoryIndex app.php
  <Directory "/var/www/intranetcms/web">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

if you dont know how to configure a local domain here is an example http://tutorial.symblog.co.uk/docs/configuration-and-templating.html but if you dont feel like configuring a local domain you can check the default site configuration file in /etc/apache2/sites-enabled/default and change AllowOverride None for AllowOverride All

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top