Symfony 2.3 Failed to delete php composer.phar update file

I follow the symbol guide: http://tutorial.symblog.co.uk/docs/doctrine-2-the-blog-model.html

I try to run: $ php composer.phar update after updating composer.json , but get the following error:

[Symfony \ Component \ Filesystem \ Exception \ IOException]
Failed to delete the file "/var/webroot/vhosts/mysite.co.uk/htdocs/Symfony/app/cache/dev_old/profiler/32/95/639532"

Permissions for this file: 0644 was the owner of www-data, and the group was sambashare, which includes the user am ssh'd in as (john).

How does it work php from the command line, php runs as "john", thus, in the group of the file to be deleted, but not the user?

Runtime error at the end:

[RuntimeException]
An error occurred while executing the command "cache: clear --no-warmup".

After a little search, some people just said that he cleared this cache manually .. but how can I fix this problem in the root, so I don’t have to do it manually?

Thanks, John

+8
php apache2 composer-php
source share
2 answers

This is a common problem with Symfony2, you should run your commands as apache2, in most cases it is www-data strong>.

You can switch to www data user using

 su www-data -s /bin/bash 

then you must install 755 in the cache folder that www-data has enough permissions. There is a goof description in the Symfony2 documentation.

http://symfony.com/doc/current/book/installation.html

Here in the documentation there is a section "Setting Permissions", you can see how you can configure ACLs and other user permissions.

+5
source share

The problem is that the PHP console commands use php-cli as the current user, as opposed to the web server user (usually www-data), which leads to permission errors.

Symfony's book explains several ways to avoid this problem.

+1
source share

All Articles