Symfony + Laragon, debug toolbar not working - php

Symfony version: 5.4.8
Project works fine but debug toolbar is all time retrying to load...
But if I start project with symfony serve and access localhost:8000 toolbar works, maybe is because toolbar is trying to access to "localhost" instead of "mydomain.test"? Anyone knows how to fix it?
Tried to install/reinstall profiler, debug, debug-bundle, apache-pack
//web_profiler.yaml
when#dev:
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }
when#test:
web_profiler:
toolbar: false
intercept_redirects: false
framework:
profiler: { collect: false }
//.env
APP_ENV=dev
APP_DEBUG=true
APP_SECRET=82fbd2b7ed4fb66bad6ce0fa48861ed5
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
DATABASE_URL="mysql://root:secret#localhost:3306/frikili?serverVersion=5.7&charset=utf8mb4"

Related

Symfony, don't show the debug bar when the paged is served from the built in server

I have a Symfony instance running on Linux with apache y NGINX. I'am starting the project using the built-in server:start command:
php bin/console server:start
Back to my browser, it loads me the Symfony start page but it also shows me the debug bar.
I have checked the config_dev.yml file and I think it is correct:
imports:
- { resource: config.yml }
framework:
router:
resource: '%kernel.project_dir%/app/config/routing_dev.yml'
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
However, if I try to access another route that I don't have, the debug bar is also shown:
You can access the prod env with:
http://127.0.0.1:8000/app.php
And accessing http://127.0.0.1:8000/app.php/a will give you an error page without the debug bar.
It is designed like this because the Symfony built-in web server is only meant to be used in development not in production. So the default environment is the "dev" one.

Web Debug Toolbar doesn't show up symfony 3

I just follow this tutorial. I created a new controller but my web debug toolbar doesn't show up. I accessed it via app_dev.php file, like , myurl/web/app_dev/contact/ even if i access my url without the contact the web debug toolbar doesn't show up.
This is my config_dev.yml file:
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: [!event]
console:
type: console
channels: [!event, !doctrine]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
#swiftmailer:
# delivery_address: me#example.com
Do i need to do some extra settings ? I'm totally lost. Thx in advance.
Double check that you are actually accessing app_dev.php. For example try renaming app_dev.php to a new name 'app_dev_temp.php', then try reloading the page. If you can still access the page you are not where you think you are.
Also check your .htaccess file, if you are using a real server instead of the Symfony built in server, by default the htaccess will direct you to the app.php, not the dev version.

symfony swiftmailer: mail not sent in prod-environment

I have a symfony 2.8 app, with fosuserbundle implemented. In the dev environment, the registration confirm mails are sent, but not in the prod environment. There is no log message and the smpt configuration is correct.
sf version: 2.8.1
swiftmailer-bundle version: current (compatible with sf version; 2.* in composer json)
fosuserbundle: 1.3.5 (* in composer)
dev-config:
imports:
- { resource: config.yml }
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
#strict_requirements: true
profiler: { only_exceptions: true }
web_profiler:
toolbar: true
intercept_redirects: true
assetic:
use_controller: true
Has anyone the same problem?
edit
I just tried a mail with the following console command in prod env: php sf --env=prod swiftmailer:email:send
Terminal output:
#!/usr/bin/env php
From: test#antondachauer.de
To: mail#antondachauer.de
Subject: test
Body: test
Sent 1 emails
But the mail has not been sent. In the dev env, it works also in terminal.
I tried all the solutions mentioned here,
which is "gethostbyname" and "change smtp of Gmail" but it did not work.
After a few days of digging, I found a solution, you need to change the encryption to tls, and add ssl in stream_options in config. It's not recommended according to the security standpoint, but it works in my case.
parameters.yml
mailer_prod_encryption: tls
config.yml
swiftmailer:
transport: "%mailer_dev_transport%"
host: "%mailer_dev_host%"
username: "%mailer_dev_user%"
password: "%mailer_dev_password%"
encryption: "%mailer_dev_encryption%"
auth_mode: "%mailer_dev_auth_mode%"
spool: { type: memory }
port: 25
stream_options:
ssl:
allow_self_signed: true
verify_peer: false

Symfony2 enable profiler but cannot reach it

I am working on a Symfony2 project, I am trying to enable the profiler so i can do further debugging. I expect to see X-debug-token-link under Response Headers but i dont see it and i cant see the toolbar at the bottom of my page.
In my routing_dev.yml it seems that these options are enabled:
framework:
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
profiler: { only_exceptions: true }
web_profiler:
toolbar: true
intercept_redirects: false
Yet I cannot reach the profiler. Is there anything I am missing...?
Make sure you run your application in dev or test environment. Even though the cookbook states that collect is enabled by default, I had to set it explicitly to activate the profiler. At least in version 2.7. Here's the configuration I use:
# app/config/dev/config.yml
framework:
# activate profiler in framework
profiler:
collect: true
# configure profiler
web_profiler:
# display the web debug toolbar at the bottom of pages with a summary of profiler info
toolbar: true
# gives you the opportunity to look at the collected data before following the redirect
intercept_redirects: false
# Exclude AJAX requests in the web debug toolbar for specified paths
excluded_ajax_paths: ^/bundles|^/_wdt
Further reading:
FrameworkBundle Configuration ("framework") profiler
WebProfilerBundle Configuration ("web_profiler")
Make sure your app_dev.php or other entry point enables the debugging:
Debug::enable();
Also make sure your routing_dev.yml contains the profiler routes:
_profiler:
resource: "#WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler

How to stop Symfony from logging Doctrine's sql queries?

I have a weird issue, when I checked my app/log/dev.log I can see almost all of my queries in my dev.log being logged in real time:
[2015-01-27 06:57:22] doctrine.DEBUG: SELECT t0.username A ....
[2015-01-27 06:57:23] doctrine.DEBUG: SELECT t0.username A ...
[2015-01-27 06:57:23] doctrine.DEBUG: SELECT s0_.id ......
I have no idea why this is happening, since I am running the site on production mode also when I check monolog in my config.yml, this is what I see:
monolog:
handlers:
pictures:
type: stream
path: %kernel.logs_dir%/pictures_%kernel.environment%.log
level: info
instagram:
type: stream
path: %kernel.logs_dir%/instagram_%kernel.environment%.log
level: info
here's what my config_dev.yml looks like:
imports:
- { resource: config.yml }
framework:
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
profiler: { only_exceptions: false }
web_profiler:
toolbar: true
intercept_redirects: false
monolog:
handlers:
main:
type: stream
path: %kernel.logs_dir%/%kernel.environment%.log
level: debug
firephp:
type: firephp
level: info
assetic:
use_controller: false
hip_mandrill:
disable_delivery: true
any idea how this could be happening?
You should use prod env on your production server. In the prod env doctrine's logging is disabled by default.
But if you want to disable logging at all (in all environments) you need to set up a config.yml like that:
doctrine:
dbal:
connections:
conn1:
driver: ...
...
logging: false
profiling: false
Reference: https://symfony.com/doc/current/bundles/DoctrineBundle/configuration.html
I encountered a similar issue with dev.log being generated on prod environment. I figured out from the log entries that what was causing my issue was a scheduled cron job calling a custom symfony command. Modifying the entry to app/console with --env=prod for my crontab since stopped dev.log being generated. i.e.
app/console --env=prod custom:command
Must have missed that section of the book :)
As I struggled with the same problem and my .log file was increasing its size the straight solution was when running the consumer use the flag --no-debug
php bin/console messenger:consume async_email_handler --no-debug

Categories