Unable to write cache symfony2

前端 未结 3 559
感情败类
感情败类 2021-01-23 02:23
RuntimeException in ClassCollectionLoader.php line 239: 

Failed to write cache file \"/var/www/fareast/app/cache/dev/classes.php\".

I have this error

相关标签:
3条回答
  • 2021-01-23 02:34

    In symfony3 i've faced the same issue...

    So, problem would not solve only using "cache clear"

    You have to change (R/W)permission of cache folder in your project

    For ex: "projectname/var/cache"
    

    Now refresh...

    If still issue is coming, change(R/W)permission of logs folder in your project

    For ex: "projectname/var/logs"
    
    0 讨论(0)
  • 2021-01-23 02:41

    You have to use the following script to determine your web server user and grant the needed permissions:

    rm -rf var/cache/*
    rm -rf var/logs/*
    HTTPDUSER = `ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1`
    sudo chmod -R +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" var
    sudo chmod -R +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" var
    
    0 讨论(0)
  • 2021-01-23 03:00

    Setting 777 permissions do nothing, because when webserver user write folders to it, the folders belong to this user, and you, as command line user haven't access to them, and vice versa. Set permissions in correct way: http://symfony.com/doc/current/book/installation.html#book-installation-permissions

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