0
votes

My symfony project is deployed on shared hosting on a sub-domain.

All un-secured modules work fine, but none of the secure modules load, and the routing fails throwing a Empty module and/or action... error. The routing is working fine for unauthenticated modules. I couldn't find much in the logs, just that the sfBasicSecurityFilter was not getting called.

To solve it,

  1. I followed the solution in this ticket and added 'POST' to the sfRequestRoute class
  2. I also tried adding the sf_method requirement to the routes
  3. The Auth module was earlier called default, so to avoid a name conflict I even changed the module name
  4. I have reset the cache multiple times
  5. It works fine on all local environments.

Any solutions?

[EDIT] Another experiment I used the frontend_dev.php controller on the setup, and compared with the log from index.php

index.php when requesting the route /pricing that comes from an unsecure module

May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signin" (/guard/login)
May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signout" (/guard/logout)
May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_forgot_password" (/guard/forgot_password)
May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfDoctrineRoute "sf_guard_forgot_password_change" (/guard/forgot_password/:unique_key)
May 23 12:37:38 symfony [info] {sfPatternRouting} Match route "home_pricing" (/pricing) for /pricing with parameters array (  'module' => 'home',  'action' => 'pricing',)
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfRenderingFilter"
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfCacheFilter"
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
May 23 12:37:38 symfony [info] {homeActions} Call "homeActions->executePricing()"
....
May 23 12:37:38 symfony [info] {sfWebResponse} Send status "HTTP/1.1 200 OK"
May 23 12:37:38 symfony [info] {sfWebResponse} Send header "Content-Type: text/html; charset=utf-8"
May 23 12:37:38 symfony [info] {sfWebResponse} Send content (6444 o)

frontend_dev.php when requesting the route /pricing that comes from an unsecure module

May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signin" (/guard/login)
May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signout" (/guard/logout)
May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_forgot_password" (/guard/forgot_password)
May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfDoctrineRoute "sf_guard_forgot_password_change" (/guard/forgot_password/:unique_key)
May 24 08:14:28 symfony [err] {sfError404Exception} Empty module and/or action after parsing the URL "/frontend_dev.php/pricing" (/).
May 24 08:14:28 symfony [info] {sfWebResponse} Send status "HTTP/1.0 404 Not Found"

I'm using HTACCESS to enable routing /public_html/.htaccess (empty)

/public_html/demo/.htaccess

#RewriteEngine on
#RewriteBase /

#RewriteCond %{REQUEST_URI} !^/web/ 
#RewriteRule .* /web/%1 [QSA]

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # we skip all files in /web
  RewriteCond %{REQUEST_URI} ^/web/
  RewriteRule .* - [L]

  # we rewrite all other files with .something to /web
  RewriteCond %{REQUEST_URI} \..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteRule ^(.*)$ /web/$1 [L]

  # !!! UNTESTED !!! ##################################
  # we check if the .html version is in /web (caching)
  #RewriteRule ^$ /web/index.html [QSA]
  #RewriteRule ^([^.]+)$ /web/$1.html [QSA]
  #####################################################

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ /web/index.php [QSA,L]

</IfModule>

# big crash from our front web controller
ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"

/public_html/demo/web/.htaccess (empty)

2

2 Answers

0
votes

Are you using sfGuardAuht? Did you executed "php symfony plugin:publish-assets" in the deployment?

0
votes

This was totally my bad. Having developed it on Windows, I had used / in one of the paths included in the sfGuard module. That created a fatal error.

Do some sort of an echo in the index.php or a die to highlight such errors.