Symfony 2 cache clearing issue

前端 未结 3 1085
灰色年华
灰色年华 2021-02-04 11:01

My Symfony 2 website has recently been giving me problems when I try to clear the cache. I type the following command in the terminal:

php app/console cache:clea         


        
相关标签:
3条回答
  • 2021-02-04 11:24

    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
    
    0 讨论(0)
  • 2021-02-04 11:24

    in Symfony3 folders with cache moved from app to var, so the command will be:

    $ rm -rf var/cache/*
    $ rm -rf var/logs/*
    $ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" var/cache var/logs
    $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" var/cache var/logs
    
    0 讨论(0)
  • You need to get your access rights on both cache & logs folders. To do that, you can follow the indications given here :

    0 讨论(0)
提交回复
热议问题