Unable to create the cache directory (/ cache /)

-2

After installing Fedora, trying to get into my application with Symfony2, I can not fix this error:

  

RuntimeException in bootstrap.php.cache line 2671: Unable to create the cache directory (/ cache /)

I've tried several alternatives, including those on the official website, but nothing.

I installed PHP through the terminal, without Apache because I use the PHP build-in server.

    
asked by anonymous 08.10.2015 / 04:09

2 answers

1

You need to delete the contents of your cache folder (and also the logs folder, if necessary) and then reconfigure the permissions of the folder.

For systems that support chmod +a :

$ rm -rf app/cache/*
$ rm -rf app/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 +a "$HTTPDUSER 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

For systems that do not support chmod +a :

$ rm -rf app/cache/*
$ rm -rf app/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 setfacl -R -m u:"$HTTPDUSER":rwX -m u:'whoami':rwX app/cache app/logs
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:'whoami':rwX app/cache app/logs
    
13.10.2015 / 20:50
0

Dude there are several things that can cause this error. Here are some possible solutions.

  • 2- You can try to update the files by composer (php composer.phar install or update), it all depends on how your project was built.

    The more likely you are to use the composer to upgrade, this error has already occurred to me and I have been able to resolve it.

        
    13.10.2015 / 20:29