Reputation: 506
I use the global symfony command to create a project under my ~/tmp/
directory, and aliased it to my /Application/MAMP/htdoc/
Apache Server's webroot.
Surprise, the project was in prod mode. I know it because the underline debug tool known as the "profiler" is missing and all my bugs was non visible, and when I search in app/logs/dev.log
, the file is missing too, but there is a app/logs/prod.log
.
If I run app/console server:run
, the project is in dev mode.
How is that possible ? Maybe all the software installed by MAMP? open_ssl, mod_fastcgi, mod_perl, mod_ssl, mod_wsgi?
I usually only use the build-in server of PHP to run the project and I never set the prod mode before.
Upvotes: 2
Views: 601
Reputation: 13167
It's due to the .htaccess
of the project's web
directory.
When you browse a Symfony application through Apache, you are in production environment by default, no matter the OS used.
To go in dev mode, open the file web/app.php
, find the following line :
$kernel = new AppKernel('prod', false); // Prod env, debug disabled
And change it to :
$kernel = new AppKernel('dev', true); // Dev env, debug enabled
It's the quicker way I know.
Otherwise, I made an override of the default a .htaccess
adapted for the dev environment.
It rewrite URLs to the app_dev.php
front-controller rather than app.php
.
Update
You need to add the following in your apache configuration :
<Directory "path/to/your/project">
DirectoryIndex app_dev.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /app_dev.php [QSA,L]
</IfModule>
</Directory>
You should create a vhost to make this configuration specific to your project, not your whole localhost.
Upvotes: 0
Reputation: 4107
I don't recommend you to change the value of the second argument of AppKernel
in web/app.php
.
Instead I recommend you to configure in your local MAMP setup to use app_dev.php
as the PHP index file, which is what the server:run
command does too.
Upvotes: 1