Symfony2 and production environment - allways displays app_dev in links

Miloš

I have a symfony2 project running with nginx and the problem is that when accessing the prod environment, all the links are still with app_dev.php there.

Here are my config files:

app.php

<?php

require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';

use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$kernel->handle(Request::createFromGlobals())->send(); 

The links in the twig file are called this way:

Route name: user_login, in twig: user_login_path()

Where could the problem come from? Nginx?

Brewal

You should always use path('route_name') in order to generate links or actions. It seems that the function(s) you are using (kind of twig extension) is bad coded and server dependent. But it does not comes with Symfony itself.

You have multiple options :

  • The cleanest : replace every href, action, ... with the path function
  • A (maybe) faster one : find the custom twig extension and make it work (more likely in src/Acme/MyBundle/Twig/MyExtension.php)
  • A quick and dirty one : rewrite every app_dev.php urls to app.dev with a .htaccess (not really recommended at all but... well...)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

UglifyJS not working in Symfony2 production environment

From Dev

Symfony2 always displays blank page in production

From Dev

Symfony2 Process::start() fails when running in production environment

From Dev

ClearCache command in Symfony2 controller does not work in production environment

From Dev

Differing error templates for dev and production in Symfony2

From Dev

Symfony swiftmailer in production environment

From Dev

In Symfony is there a way to access the app_dev information with REST

From Dev

Links in Symfony2

From Dev

Symfony2 LessPHP works fine in dev environment but not in prod

From Dev

Environment variable with webpack on dev and production

From Dev

Dev Exceptions are shown in production environment

From Dev

Dev Exceptions are shown in production environment

From Dev

Symfony Send email in production environment

From Dev

404 page is working dev environment but not working in Prod environment in Symfony2

From Dev

Routing and Cache issues in Symfony2 production mode (app.php)

From Dev

Routing and Cache issues in Symfony2 production mode (app.php)

From Dev

GIT Dev/Testing/Production Environment Best Practices

From Dev

How to use docker in both dev and production environment?

From Dev

Symfony2 Production incorrect "404"

From Dev

Symfony 2 Assetic css and js 404 within production environment

From Dev

Symfony login_check not handled on production environment

From Dev

breadcrumbs with gretel gem working on dev environment but not working on production environment on Heroku

From Dev

Any way to debug app with dataset in production environment?

From Dev

Add field to existing django app in production environment

From Dev

Run Mac App with CloudKit connected to the Production environment

From Dev

Angular2 deploying to production environment questions

From Dev

Angular 2 and Team City Production/Environment Variables

From Dev

Preparing a Production Environment for WSO2

From Dev

Vagrant + Symfony2 Environment ContextErrorException Weirdness

Related Related

  1. 1

    UglifyJS not working in Symfony2 production environment

  2. 2

    Symfony2 always displays blank page in production

  3. 3

    Symfony2 Process::start() fails when running in production environment

  4. 4

    ClearCache command in Symfony2 controller does not work in production environment

  5. 5

    Differing error templates for dev and production in Symfony2

  6. 6

    Symfony swiftmailer in production environment

  7. 7

    In Symfony is there a way to access the app_dev information with REST

  8. 8

    Links in Symfony2

  9. 9

    Symfony2 LessPHP works fine in dev environment but not in prod

  10. 10

    Environment variable with webpack on dev and production

  11. 11

    Dev Exceptions are shown in production environment

  12. 12

    Dev Exceptions are shown in production environment

  13. 13

    Symfony Send email in production environment

  14. 14

    404 page is working dev environment but not working in Prod environment in Symfony2

  15. 15

    Routing and Cache issues in Symfony2 production mode (app.php)

  16. 16

    Routing and Cache issues in Symfony2 production mode (app.php)

  17. 17

    GIT Dev/Testing/Production Environment Best Practices

  18. 18

    How to use docker in both dev and production environment?

  19. 19

    Symfony2 Production incorrect "404"

  20. 20

    Symfony 2 Assetic css and js 404 within production environment

  21. 21

    Symfony login_check not handled on production environment

  22. 22

    breadcrumbs with gretel gem working on dev environment but not working on production environment on Heroku

  23. 23

    Any way to debug app with dataset in production environment?

  24. 24

    Add field to existing django app in production environment

  25. 25

    Run Mac App with CloudKit connected to the Production environment

  26. 26

    Angular2 deploying to production environment questions

  27. 27

    Angular 2 and Team City Production/Environment Variables

  28. 28

    Preparing a Production Environment for WSO2

  29. 29

    Vagrant + Symfony2 Environment ContextErrorException Weirdness

HotTag

Archive