Answer the question
In order to leave comments, you need to log in
Symfony2 how to clear the cache correctly?
Good day!
Problem:
1) I'm a beginner developer and I'm just starting to learn OOP, PHP, its frameworks, etc.
2) I was given a site on symfony 2 for revision and I am completely confused, because its structure is quite complicated for a beginner.
3) I need to change the content of several pages (add a jquery slider and fix the location of several elements [and if everything was decided by css] ).
4) I realized that I need to edit the twig files of the pages, but nothing happens when they change! (the code changes - the page remains untouched).
5) In my opinion, it's all about the cache, but I don't know how to clean it properly.
Help me please!
Answer the question
In order to leave comments, you need to log in
when editing code, use a different entry point (app_dev.php).
the cache is cleared from the console:
app/console cache:clear
for production, you need to specify the environment by adding the --env=prod parameter. By default, all console commands are run in the dev environment.
The resulting command will be
app/console cache:clear -e=prod.
Another small bonus - you can write the names of the teams not to the end. For example
, app/console cach/cl - the main thing is that what is written is enough to select the desired command.
go to the app folder, there you will see the cache folder. Just delete it (cache folder) and that's it. Refresh page, cache cleared
google > bash
google > PuTTY (ssh client)
You can open the app/cache folder and delete its contents (but not the cache folder itself).
In order not to constantly clear the cache, you can go to the site via site.com/app_dev.php
If the project is being edited on a remote server, this file must be edited by deleting these lines:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($ _SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1'))
) {
header('HTTP/ 1.0 403 Forbidden');
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question