Reputation: 6725
I moved my application in production mode in symfony 2 with this cmd Line
php app/console cache:clear --env=prod --no-debug
And In my "web/app.php" file
$kernel = new AppKernel('prod', false);
I changed false value to true
$kernel = new AppKernel('prod', true);
But My application still give me pages error like DEV mod ; For example whene i try to access a wrong link a get this page error
Normaly the page error should be like this
Upvotes: 1
Views: 143
Reputation: 13167
First, verify if the .htaccess
is present in the web
directory of your app.
Otherwise, take it from here and create it.
Open it and check that URLs are redirected to /app.php/
.
If you see a line containing app_dev.php
, change it to app.php
.
For example, if you see the following line:
RedirectMatch 302 ^/$ /app_dev.php/
Change it to :
RedirectMatch 302 ^/$ /app.php/
Then, verify your web/app.php
looks like default .
Also, the line you given should be :
new AppKernel('prod', false')
And last, in the vhost of your prod environment, verify you doesn't specify any index
like app_dev.php
.
The default .htaccess
do it for you.
The vhost can be like follows:
<VirtualHost *:80>
ServerName your.domain
DocumentRoot /var/www/path/to/project/web
<Directory "/var/www/path/to/project/web">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Hope your problem come from one of this common errors.
Upvotes: 2
Reputation: 3065
Clear the cache manually deleting the content of the cache folder
Note that the second parameter of the kernel needs to be false, otherwise the message errors will display anyway.
$kernel = new AppKernel('prod',false);
Upvotes: 1