【发布时间】:2017-02-08 02:46:33
【问题描述】:
当我尝试更新 composer 或清除我的 symfony 项目的缓存时,我经常遇到文件权限错误。 然而我的文件是根据 symfony 的文档正确设置的:http://symfony.com/doc/current/setup/file_permissions.html
我在linux下,Manjaro Budgie版(最后一个稳定版) 服务器 apache 最新版本
例如:
composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
// Clearing the cache for the dev environment with debug true
[Symfony\Component\Filesystem\Exception\IOException]
Failed to remove file "/srv/http/PetitMur/var/cache/de~/annotations/1a/5b504d5c506c6174666f726d42756e646c655c456e746974795c41727469636c652474616773405b416e6e6f745d5d5b315d.doctrinecache.data": .
此文件具有以下权限:
pierre $ la /srv/http/PetitMur/var/cache/de~/annotations...data
-rw-rw-r--+ 1 http http 234 29.09.2016 18:13 /srv/http/PetitMur/var/cache/de~/annotations...data
我知道,这个问题经常出现。但是我已经按照symfony的doc设置了权限文件。目前我必须在超级用户上运行命令才能使其工作,这是不正常的。
你有想法吗?
编辑:
php bin/symfony_requirements
Symfony Requirements Checker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> PHP is using the following php.ini file:
/etc/php/php.ini
> Checking Symfony requirements:
.............................WW......
[OK]
Your system is ready to run Symfony projects
Optional recommendations to improve your setup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* intl extension should be available
> Install and enable the intl extension (used for validators).
* a PHP accelerator should be installed
> Install and/or enable a PHP accelerator (highly recommended).
Note The command console could use a different php.ini file
~~~~ than the one used with your web server. To be on the
safe side, please check the requirements from your web
server using the web/config.php script.
【问题讨论】:
-
你试过用 rm -rf var/cache/* 清除吗?
-
是的,但过一段时间问题又回来了。
-
哪个网络服务器?是阿帕奇吗?
-
还有,请问是哪个 Linux 发行版。
-
文件归用户htttp所有,您的clearCache命令是否在root下运行?...可能是用户权限问题,而不是文件权限问题
标签: php composer-php symfony