It'd be quite nice to see some info on setting up a run config so we can also debug from php storm. I configured a built in php web server profile and it works and I can debug but I have to use a URL of the form http://localhost:8000/app_dev.php/genus/foobar/notes . Can anyone tell me how I can avoid the app_dev.php part? Some sort of "always run through this" option that I'm not seeing in the php options?
Why are you try to avoid `app_dev.php` in URL? Anyway, it's some thing internal, only *you* should have access to this file and *only* on your localhost machine. So it's not a big deal to use it. But on production you should close this front controller, many devs just remove it at all from production server.
Btw, if you will run built in PHP web server via symfony console with `$ bin/console server:run` - it will load app_dev.php file by default, so you don't need to add /app_dev.php/ after your domain.
You should totally see the web debug toolbar in ALL browsers, even Internet Explorer :p. However, the web debug toolbar doesn't show up until you have a full, valid HTML page. In other words, you won't see the web debug toolbar until you have valid <html>, <head>, and <body> tags. You *should* get this as soon as you extend the base.html.twig template.
However, if you don't see the web debug toolbar, view the HTML source on your page and make sure you have full valid HTML page markup. This is usually the reason why you won't see the web debug toolbar (Symfony purposefully only adds if when it sees full valid markup).
My site was in 'prod' - I switched it to 'dev' by changing web/.htaccess. Here I replaced app.php with app_dev.php Did I change the environment by accident ? Is there an easy way to change the environment ?
Ah, very clever! So ultimately, you "choose" the environment simply by executing app.php (prod) or app_dev.php (dev). But, there are 2 different ways of doing this usually:
1) Actually put app.php or app_dev.php in your URL - e.g. http://somehostname/app_dev.php/genus/octopus. Unless you're really misconfigured your web server, this will always work :).
2) Update your .htaccess file (or more generally, update your web server configuration - but for Apache, this is usually done in web/.htaccess) to load app_dev.php by default (i.e. when there is no filename in the URL). Then, when you go to http://somehostname/genus/octopus, it really executes app_dev.php, which loads Symfony in the dev environment. If you do this approach, you'll just want to make sure that you *don't* do after you deploy to production - you definitely want "app.php" to be executed when you're up on your server.
So you basically did option (2), which is completely valid :).
10 Comments
dont work for me, and i have exactly that
Hey David,
What problem do you have? Do you can't inherit template?
It'd be quite nice to see some info on setting up a run config so we can also debug from php storm. I configured a built in php web server profile and it works and I can debug but I have to use a URL of the form http://localhost:8000/app_dev.php/genus/foobar/notes . Can anyone tell me how I can avoid the app_dev.php part? Some sort of "always run through this" option that I'm not seeing in the php options?
Hey Richard ,
Why are you try to avoid `app_dev.php` in URL? Anyway, it's some thing internal, only *you* should have access to this file and *only* on your localhost machine. So it's not a big deal to use it. But on production you should close this front controller, many devs just remove it at all from production server.
Btw, if you will run built in PHP web server via symfony console with `$ bin/console server:run` - it will load app_dev.php file by default, so you don't need to add /app_dev.php/ after your domain.
Cheers!
Why is the bar only in chrome, Safari desn't support it?
Hi Konrad!
You should totally see the web debug toolbar in ALL browsers, even Internet Explorer :p. However, the web debug toolbar doesn't show up until you have a full, valid HTML page. In other words, you won't see the web debug toolbar until you have valid <html>, <head>, and <body> tags. You *should* get this as soon as you extend the base.html.twig template.
However, if you don't see the web debug toolbar, view the HTML source on your page and make sure you have full valid HTML page markup. This is usually the reason why you won't see the web debug toolbar (Symfony purposefully only adds if when it sees full valid markup).
Cheers!
Ok, thanks!
My site was in 'prod' - I switched it to 'dev' by changing web/.htaccess. Here I replaced app.php with app_dev.php
Did I change the environment by accident ? Is there an easy way to change the environment ?
Hi Klemens!
Ah, very clever! So ultimately, you "choose" the environment simply by executing app.php (prod) or app_dev.php (dev). But, there are 2 different ways of doing this usually:
1) Actually put app.php or app_dev.php in your URL - e.g. http://somehostname/app_dev.php/genus/octopus. Unless you're really misconfigured your web server, this will always work :).
2) Update your .htaccess file (or more generally, update your web server configuration - but for Apache, this is usually done in web/.htaccess) to load app_dev.php by default (i.e. when there is no filename in the URL). Then, when you go to http://somehostname/genus/octopus, it really executes app_dev.php, which loads Symfony in the dev environment. If you do this approach, you'll just want to make sure that you *don't* do after you deploy to production - you definitely want "app.php" to be executed when you're up on your server.
So you basically did option (2), which is completely valid :).
Cheers!
Thanks for the quick answer! [besides: great tutorials !]
"Houston: no signs of life"
Start the conversation!