I am following the guide on symblog: http://tutorial.symblog.co.uk/docs/doctrine-2-the-blog-model.html
I am trying to run:
$ php composer.phar update after updating the
composer.json but get the following error:
[Symfony\Component\Filesystem\Exception\IOException] Failed to remove file
The permissions on this file is: 0644 were the owner is www-data and the group is sambashare which includes the user i am ssh’d in as (john).
As this is running php from command line, is php being run as ‘john’ thus in the group of the file wanting to be removed but not the user?
The runtime error at the end it:
[RuntimeException] An error occurred when executing the “‘cache:clear –no-warmup'” command.
After a bit of searching some people have just said clear this cache manually.. but how can i fix this issue at the root so i do not have to do this manually?
This is a common problem with Symfony2 you should run your commands under the apache2 user in most cases this is the www-data user.
You can switch to the www-data user with
su www-data -s /bin/bash
then you should set 755 to the cache folder that the www-data has enough permissions. There is a goof explanation in the Symfony2 documentation about that.
Here in the documentation is a section “Setting up Permissions” there you can see how you can configure ACLs and other user permissions.
The problem is PHP console commands use php-cli running under the current user as opposed to the web server’s user (usually www-data), leading to permission errors.
The Symfony book explains several ways to avoid the issue.