Symfony 2.7 Cache:Clear Command Checks Every Database Connection

Symfony 2.7 cache:clear command checks every database connection

Doctrine is trying to determine the Database Platform Version.

You can avoid this behavior by adding the server version in the Doctrine DBAL Configuration. From the doc:

The server_version option was added in Doctrine DBAL 2.5, which is
used by DoctrineBundle 1.3. The value of this option should match your
database server version (use postgres -V or psql -V command to find
your PostgreSQL version and mysql -V to get your MySQL version).

If you don't define this option and haven't created your database yet, you may get PDOException errors because Doctrine will
try to guess the database server version automatically and none is
available.

As example:

#config.yml

doctrine:
dbal:
...
server_version: 5.6

Hope this helps

Symfony: Clear doctrine cache

For Symfony 3+:

 php bin/console

will list all commands, the following are relevant for cache:

 php bin/console doctrine:cache:clear-metadata 
php bin/console doctrine:cache:clear-query
php bin/console doctrine:cache:clear-result

Before Symfony 3:

app/console

will list how you can do it

 app/console doctrine:cache:clear-metadata 
app/console doctrine:cache:clear-query
app/console doctrine:cache:clear-result

Symfony 2 cache clearing issue

You need to get your access rights on both cache & logs folders. To do that, you can follow the indications given here : http://symfony.com/doc/current/book/installation.html#configuration-and-setup

There are several ways, depending on your OS (replace www-data with your apache user):

If it supports chmod +a:

$ rm -rf app/cache/*
$ rm -rf app/logs/*

$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs

Else, if it supports setfacl (see https://help.ubuntu.com/community/FilePermissionsACLs):

$ sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/cache app/logs
$ sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs

Else, put those lines in the beginning of app/console, web/app.php & web/app_dev.php (not recommended):

umask(0002); // This will let the permissions be 0775

// or

umask(0000); // This will let the permissions be 0777

Symfony & Doctrine - Repository or Doctrine cache to clear?

Sometimes that happend to me and the only thing I do is restart apache and whola. Is weird IDK why apache saves some cache for entities, try it and let me know if that works for you. Good Luck !

Cant clear the cache on my symfony2 website

Have you an existing /var/www/mysite.co.uk/app/cache/prod_old directory?

You can delete manually the cache/prod to force cache cleaning.



Related Topics



Leave a reply



Submit