Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For a GOOD and definite solution see the <code>Setting up Permissions</code> section in <code>Installing and Configuring Symfony</code> section : </p> <blockquote> <p>Setting up Permissions</p> <p>One common issue when installing Symfony is that the app/cache and app/logs directories must be writable both by the web server and the command line user. On a UNIX system, if your web server user is different from your command line user, you can try one of the following solutions.</p> <ol> <li>Use the same user for the CLI and the web server</li> </ol> <p>In development environments, it is a common practice to use the same UNIX user for the CLI and the web server because it avoids any of these permissions issues when setting up new projects. This can be done by editing your web server configuration (e.g. commonly httpd.conf or apache2.conf for Apache) and setting its user to be the same as your CLI user (e.g. for Apache, update the User and Group values).</p> <ol start="2"> <li>Using ACL on a system that supports chmod +a</li> </ol> <p>Many systems allow you to use the chmod +a command. Try this first, and if you get an error - try the next method. This uses a command to try to determine your web server user and set it as HTTPDUSER:</p> <pre><code>$ rm -rf app/cache/* $ rm -rf app/logs/* $ HTTPDUSER=`ps aux | 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 </code></pre> <ol start="3"> <li>Using ACL on a system that does not support chmod +a</li> </ol> <p>Some systems don't support chmod +a, but do support another utility called setfacl. You may need to enable ACL support on your partition and install setfacl before using it (as is the case with Ubuntu). This uses a command to try to determine your web server user and set it as HTTPDUSER:</p> <pre><code>$ HTTPDUSER=`ps aux | 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 </code></pre> <p>For Symfony 3 it would be:</p> <pre><code>$ HTTPDUSER=`ps aux | 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 var/cache var/logs $ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var/cache var/logs </code></pre> <p>If this doesn't work, try adding -n option.</p> <ol start="4"> <li>Without using ACL</li> </ol> <p>If none of the previous methods work for you, change the umask so that the cache and log directories will be group-writable or world-writable (depending if the web server user and the command line user are in the same group or not). To achieve this, put the following line at the beginning of the app/console, web/app.php and web/app_dev.php files:</p> <pre><code>umask(0002); // This will let the permissions be 0775 // or umask(0000); // This will let the permissions be 0777 </code></pre> <p>Note that using the ACL is recommended when you have access to them on your server because changing the umask is not thread-safe.</p> </blockquote> <p><a href="http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup" rel="nofollow noreferrer">http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup</a></p> <p>source : <a href="https://stackoverflow.com/questions/8449345/symfony-2-cacheclear-bug">Failed to write cache file &quot;/var/www/myapp/app/cache/dev/classes.php&quot; when clearing the cache</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload