Dev env files created in Prod env - symfony

I'm running my symfony2 project in prod environment, I've executed :
rm-rf app/cache/dev
rm-rf app/cache/prod
When I visit one of ma pages (cache created), I find files in dev folder.
the folders created are:
Can you explain why to me.
This is my config file
Config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
framework:
profiler:
enabled: true
#esi: ~
#translator: { fallback: "%locale%" }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
cookie_lifetime: 43200
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
salva_jshrink:
flaggedComments: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ ]
filters:
cssrewrite: ~
# Swiftmailer Configuration
swiftmailer:
transport: smtp
# transport: "%mailer_transport%"
# host: "%mailer_host%"
# username: "%mailer_user%"
# password: "%mailer_password%"
spool: { type: memory }
# app/config/config.yml
doctrine_mongodb:
connections:
default:
server: mongodb://user:password#127.0.0.1:27017
options: {}
default_database: database
document_managers:
default:
auto_mapping: true
metadata_cache_driver:
type: memcached
class: Doctrine\Common\Cache\MemcachedCache
host: localhost
port: 11211
instance_class: Memcached
web_profiler:
toolbar: true

Related

Symfony Application (OroCommerce) appears to be using file cache after configuring SncRedis

I am new to Symfony and I am jumping into the deep end with OroCommerce. I thought I had successfully setup SncRedis (solely based on the fact that the app quit throwing errors at me). However, now that the app is completely setup and installed, I can see that file-based cache is still being generated.
I have a config.yml in place as well as a config_prod.yml but it seems that config_prod.yml only extends the config.yml so I don't think there are any conflicts in config_prod.yml.
# config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
translator: { fallback: en }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: "%kernel.debug%"
form: true
csrf_protection: true
validation: { enable_annotations: true }
templating:
engines: ['twig', 'php']
assets_version: %assets_version%
assets_version_format: %%s?version=%%s
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments:
enabled: true
path: /_fragment # used for controller action in template
serializer:
enabled: true
annotations:
cache: oro.cache.annotations
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
exception_controller: "FOS\RestBundle\Controller\ExceptionController::showAction"
globals:
bap:
layout: ::base.html.twig # default layout across all Oro bundles
# Assetic Configuration
assetic:
debug: false
use_controller: false
filters:
cssrewrite: ~
lessphp:
file: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php
apply_to: "\.less$"
paths: ["%kernel.root_dir%/../web/bundles"]
cssmin:
file: %kernel.root_dir%/Resources/php/cssmin-v3.0.1.php
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
port: "%mailer_port%"
encryption: "%mailer_encryption%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
fos_rest:
body_listener:
decoders:
json: fos_rest.decoder.json
view:
failed_validation: HTTP_BAD_REQUEST
default_engine: php
formats:
json: true
xml: false
format_listener:
rules:
- { path: '^/api/rest', priorities: [ json ], fallback_format: json, prefer_extension: false }
- { path: '^/api/soap', stop: true }
- { path: '^/', stop: true }
routing_loader:
default_format: json
fos_js_routing:
routes_to_expose: [oro_*]
oro_frontend:
routes_to_expose: [oro_*]
stof_doctrine_extensions:
default_locale: en
translation_fallback: true
orm:
default:
translatable: true
tree: true
services:
twig.extension.intl:
class: Twig_Extensions_Extension_Intl
tags:
- { name: twig.extension }
oro.cache.abstract:
abstract: true
class: Snc\RedisBundle\Doctrine\Cache\RedisCache
calls:
- [setRedis, ["#snc_redis.default"]]
oro.cache.annotations:
public: false
parent: oro.cache.abstract
calls:
- [ setNamespace, [ "oro_annotations_cache" ] ]
escape_wsse_authentication:
authentication_provider_class: Oro\Bundle\UserBundle\Security\WsseAuthProvider
genemu_form:
select2: ~
autocomplete: ~
a2lix_translation_form:
locales: [en, fr]
templating: "OroUIBundle:Form:translatable.html.twig"
lexik_maintenance:
authorized:
path: "maintenance|.*\.js" # "maintenance" is only for demo purposes, remove in production!
# ips: ["127.0.0.1"] # Optional. Authorized ip addresses
driver:
class: Lexik\Bundle\MaintenanceBundle\Drivers\FileDriver
options:
file_path: %kernel.root_dir%/cache/maintenance_lock
#
# ORO Bundles config
#
oro_distribution:
entry_point: ~
oro_require_js:
build_path: "js/oro.min.js"
building_timeout: 3600
build:
preserveLicenseComments: true
oro_help:
defaults:
server: http://help.orocrm.com/
prefix: Third_Party
vendors:
Oro:
prefix: ~
alias: Platform
routes:
oro_default:
uri: Platform/OroDashboardBundle
oro_theme:
active_theme: oro
oro_message_queue:
transport:
default: '%message_queue_transport%'
'%message_queue_transport%': '%message_queue_transport_config%'
client: ~
snc_redis:
clients:
default:
type: predis
alias: default
dsn: redis://redis-session
logging: %kernel.debug%
session:
type: predis
alias: session
dsn: redis://redis-session/4
logging: %kernel.debug%
cache:
type: predis
alias: cache
dsn: redis://redis-session/1
logging: true
profiler_storage:
type: predis
alias: profiler_storage
dsn: redis://redis-session/2
logging: false
session:
client: session
prefix: session
doctrine:
metadata_cache:
client: cache
entity_manager: default
document_manager: default
result_cache:
client: cache
entity_manager: [default, read]
document_manager: [default, slave1, slave2]
namespace: "dcrc:"
query_cache:
client: cache
entity_manager: default
swiftmailer:
client: default
key: swiftmailer
doctrine:
orm:
query_cache_driver: redis
result_cache_driver: redis
jms_serializer:
metadata:
cache: Metadata\Cache\DoctrineCacheAdapter
You can install OroRedisConfigBundle that have snc/redis-bundle in dependency Instead. After that to work with redis you need to add 4 lines in parameters.yml of your application like:
session_handler: 'snc_redis.session.handler'
redis_dsn_session: 'redis://127.0.0.1:6379/0'
redis_dsn_cache: 'redis://127.0.0.1:6380/0'
redis_dsn_doctrine: 'redis://127.0.0.1:6380/1'
Don't forget to clear application cache.
And about cache folder (app/cache/prod for example). For Symfony applications it always be even if you enable redis.

Fosuserbundle : Redirection to check email page after registration does'nt work on server

I encounter a problem and I have no idea how to solve it.
I realized a symfony project in which there are user accounts (I used fosuserbundle). When a user registers, he is redirected to the "check-email" page.
It works fine from my local computer.
But on the server where the project is deposited, it brings me back on the registration form, the mail is sent but no check email page is displayed.
I have cleared the cache, all the files are up to date, so where can it come from?
If you have an idea, it would be great, thank you
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: fr
framework:
#esi: ~
translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
fragments: ~
http_method_override: true
assets: ~
php_errors:
log: true
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
form_themes:
- 'bootstrap_3_horizontal_layout.html.twig'
- 'VichUploaderBundle:Form:fields.html.twig'
globals:
nb_news_per_page: '%nb_news_per_page%'
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/../var/data/data.sqlite"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
#path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
knp_paginator:
page_range: 6
default_options:
page_name: page
sort_field_name: sort
sort_direction_name: direction
distinct: true
template:
pagination: KnpPaginatorBundle:Pagination:twitter_bootstrap_v3_pagination.html.twig
sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig
fos_user:
db_driver: orm
firewall_name: main
user_class: ACT\UserBundle\Entity\User
registration:
confirmation:
enabled: true
template: ACTUserBundle:Registration:email.txt.twig
from_email:
address: #mon adresse
sender_name: admin
service:
user_manager: pugx_user_manager
mailer: fos_user.mailer.twig_swift
resetting:
email:
template: '#FOSUser/Resetting/email.txt.twig'
pugx_multi_user:
users:
user_candidat:
entity:
class: ACT\UserBundle\Entity\Candidat
registration:
form:
type: ACT\UserBundle\Form\RegistrationCandidatFormType
name: act_userbundle_candidat
template: ACTUserBundle:Registration:user_candidat.form.html.twig
profile:
form:
type: ACT\UserBundle\Form\ProfilCandidatFormType
template: ACTUserBundle:Profile:user_candidat_p.form.html.twig
user_referent:
entity:
class: ACT\UserBundle\Entity\Referent
registration:
form:
type: ACT\UserBundle\Form\RegistrationReferentFormType
name: act_userbundle_referent
template: ACTUserBundle:Registration:user_referent.form.html.twig
profile:
form:
type: ACT\UserBundle\Form\ProfilReferentFormType
template: ACTUserBundle:Profile:user_referent_p.form.html.twig
assetic:
debug: '%kernel.debug%'
use_controller: '%kernel.debug%'
filters:
cssrewrite: ~
jsqueeze: ~
scssphp:
formatter: 'Leafo\ScssPhp\Formatter\Compressed'

PHP Fatal error: Uncaught exception 'Symfony\Component\Yaml\Exception\ParseException'

I have this bug when I use symfony 2.8, bug in config.yml maybe , help me please for resolve this problem and thanks advanced
FileLoaderLoadException in FileLoader.php line 133:
The file "/var/www/html/authenti/app/config/config.yml" does not contain valid YAML in /var/www/html/authenti/app/config/config.yml (which is being imported from "/var/www/html/authenti/app/config/config_dev.yml").
code config.yml:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: en
framework:
#esi: ~
#translator: { fallbacks: ['%locale%'] }
secret: '%secret%'
router:
resource: '%kernel.root_dir%/config/routing.yml'
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: '%locale%'
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: '%kernel.root_dir%/data/data.db3'
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
#path: '%database_path%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
username: '%mailer_user%'
password: '%mailer_password%'
spool: { type: memory }
imports:
// ...
- { resource: security.yml }
// ...
framework:
// ...
csrf_protection: ~
form: ~
session:
handler_id: ~
// ...
fos_user:
db_driver: orm
firewall_name: main
user_class: AppBundle\Entity\User
lexik_jwt_authentication:
private_key_path: %jwt_private_key_path%
public_key_path: %jwt_public_key_path%
pass_phrase: %jwt_key_pass_phrase%
token_ttl: %jwt_token_ttl%
// ...
dunglas_api:
title: "%api_name%"
description: "%api_description%"
enable_fos_user: true
nelmio_cors:
defaults:
allow_origin: ["%cors_allow_origin%"]
allow_methods: ["POST", "PUT", "GET", "DELETE", "OPTIONS"]
allow_headers: ["content-type", "authorization"]
expose_headers: ["link"]
max_age: 3600
paths:
'^/': ~
routing.yml:
app:
resource: '#AppBundle/Controller/'
type: annotation
api:
resource: "."
type: "api"
prefix: "/api"
api_login_check:
path: "/login_check"
parameters.yml.dist:
# This file is a "template" of what your parameters.yml file should look like
# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production.
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
parameters:
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
# You should uncomment this if you want to use pdo_sqlite
#database_path: "%kernel.root_dir%/data.db3"
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
jwt_private_key_path: %kernel.root_dir%/var/jwt/private.pem
jwt_public_key_path: %kernel.root_dir%/var/jwt/public.pem
jwt_key_pass_phrase : 'test'
jwt_token_ttl: 86400
cors_allow_origin: http://localhost:9000
api_name: Your API name
api_description: The full description of your API
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
try to indent well, I seen this for example to fix:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
Corrected:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }

"NetworkError: 404 Not Found - /stylesheet/bootstrap.min.css"

I'm a beginner with Symfony2 but I need to duplicate a website made with this frameworks. When I want to run the site as localhost there is no CSS on the page and errors of loading css appears. Do you know how to fix it ? Actually the files exist in the folder web/bundle/...
My css errors
my config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: admin.yml}
# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
framework:
#esi: ~
translator:
enabled: true
fallbacks: ["%locale%"]
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
# FOSUserBundle Configuration
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: AppBundle\Entity\User
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
globals:
gmaps_api_key: "%gmaps_api_key%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: ['AppBundle']
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
# FOSRestBundle Configuration
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
view_response_listener: 'force'
formats:
xml: true
json : true
templating_formats:
html: true
force_redirects:
html: true
failed_validation: HTTP_BAD_REQUEST
default_engine: twig
exception_wrapper_handler: null
routing_loader:
default_format: json
service:
exception_handler: fos_rest.view.exception_wrapper_handler
run app/console assets:install && app/console assetic:dump command
assetic:dump can be not found, it depend the version of symfony

HWIOAuthBundle error non-existent service "session"

I've looked at everywhare but could not find a reference to this:
After configuring the HWIOAuthBundle and get a few problems solved I got the following error:
( ! ) Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException' with message 'The service "hwi_oauth.resource_owner.google" has a dependency on a non-existent service "session".' in E:\Servidor\Wamp\wamp\www\DEVELOPMENT\magnetics\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass.php on line 64
I'm using Symfony 2.6 and here are my configuration file:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernel.debug%
form: ~
csrf_protection: false
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: false
fragments: ~
hwi_oauth:
# name of the firewall in which this bundle is active, this setting MUST be set
firewall_name: secured_area
resource_owners:
google:
type: google
client_id: "977681365085-3pb"
client_secret: "0IvhJ-DL7"
scope: "https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
#options:
#access_type: offline
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction'
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ MagneticsAdminBundle ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: %kernel.root_dir%/data/data.db3
# path: %database_path%
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
sensio_framework_extra:
view: { annotations: false }
fos_rest:
disable_csrf_role: ROLE_API
param_fetcher_listener: true
view:
mime_types:
json: ['application/json', 'application/json;version=1.0', 'application/json;version=1.1']
view_response_listener: 'force'
formats:
xml: true
json: true
templating_formats:
html: true
format_listener:
rules:
- { path: ^/, priorities: [ html, json, xml ], fallback_format: ~, prefer_extension: true }
media_type:
version_regex: '/(v|version)=(?P<version>[0-9\.]+)/'
exception:
codes:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
messages:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
allowed_methods_listener: true
access_denied_listener:
json: true
body_listener: true
fos_http_cache:
cache_control:
rules:
# the controls section values are used in a call to Response::setCache();
-
match:
path: ^/notes
methods: [GET, HEAD]
headers:
cache_control: { public: true, max_age: 15, s_maxage: 30 }
last_modified: "-1 hour"
vary: [Accept-Encoding, Accept-Language]
I've found similar problems but none of the solutions worked for me, anyone has an idea?
You have sessions disabled in your config
session: false
I don't know this for sure, but I'm going to guess that the session service isn't created when sessions are disabled at the framework level.
You can check by debugging the container
$ php app/console container:debug
Or more targeted
$ php app/console container:debug session

Resources