Symfony 4 Cache:没有这样的文件或目录

时间:2018-02-28 10:19:27

标签: php symfony

我尝试使用symfony 4创建一个新项目。项目文件夹是通过默认的symfony 4 skelleton项目composer create-project symfony/website-skeleton test创建的。

这是命令的输出:

composer create-project symfony/website-skeleton test
Installing symfony/website-skeleton (v3.4.4)
  - Installing symfony/website-skeleton (v3.4.4): Loading from cache
Created project in test
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 89 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.2.0): Loading from cache
  - Installing symfony/flex (v1.0.70): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing doctrine/inflector (v1.2.0): Loading from cache
  - Installing doctrine/collections (v1.4.0): Loading from cache
  - Installing doctrine/cache (v1.6.2): Loading from cache
  - Installing doctrine/annotations (v1.4.0): Loading from cache
  - Installing doctrine/common (v2.7.3): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.7.0): Loading from cache
  - Installing symfony/yaml (v3.4.4): Loading from cache
  - Installing symfony/webpack-encore-pack (v1.0.2): Loading from cache
  - Installing psr/link (1.0.0): Loading from cache
  - Installing fig/link-util (1.0.0): Loading from cache
  - Installing symfony/web-link (v3.4.4): Loading from cache
  - Installing symfony/filesystem (v3.4.4): Loading from cache
  - Installing symfony/config (v3.4.4): Loading from cache
  - Installing symfony/http-foundation (v3.4.4): Loading from cache
  - Installing symfony/event-dispatcher (v3.4.4): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v3.4.4): Loading from cache
  - Installing symfony/http-kernel (v3.4.4): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/dependency-injection (v3.4.4): Loading from cache
  - Installing egulias/email-validator (2.1.3): Loading from cache
  - Installing swiftmailer/swiftmailer (v6.0.2): Loading from cache
  - Installing symfony/swiftmailer-bundle (v3.2.0): Loading from cache
  - Installing symfony/translation (v3.4.4): Loading from cache
  - Installing symfony/validator (v3.4.4): Loading from cache
  - Installing symfony/serializer (v3.4.4): Loading from cache
  - Installing symfony/inflector (v3.4.4): Loading from cache
  - Installing symfony/property-info (v3.4.4): Loading from cache
  - Installing symfony/property-access (v3.4.4): Loading from cache
  - Installing psr/simple-cache (1.0.0): Loading from cache
  - Installing psr/cache (1.0.1): Loading from cache
  - Installing symfony/polyfill-apcu (v1.7.0): Loading from cache
  - Installing symfony/cache (v3.4.4): Loading from cache
  - Installing webmozart/assert (1.3.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
  - Installing symfony/serializer-pack (v1.0.1): Loading from cache
  - Installing symfony/security (v3.4.4): Loading from cache
  - Installing symfony/security-bundle (v3.4.4): Loading from cache
  - Installing symfony/process (v3.4.4): Loading from cache
  - Installing monolog/monolog (1.23.0): Loading from cache
  - Installing symfony/monolog-bridge (v3.4.4): Loading from cache
  - Installing symfony/monolog-bundle (v3.1.2): Loading from cache
  - Installing symfony/routing (v3.4.4): Loading from cache
  - Installing symfony/finder (v3.4.4): Loading from cache
  - Installing symfony/class-loader (v3.4.4): Loading from cache
  - Installing symfony/framework-bundle (v3.4.4): Loading from cache
  - Installing symfony/console (v3.4.4): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.0): Loading from cache
  - Installing zendframework/zend-code (3.1.0): Loading from cache
  - Installing ocramius/proxy-manager (2.0.4): Loading from cache
  - Installing doctrine/dbal (v2.5.13): Loading from cache
  - Installing doctrine/migrations (v1.5.0): Loading from cache
  - Installing symfony/doctrine-bridge (v3.4.4): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.2): Loading from cache
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing doctrine/doctrine-bundle (1.8.1): Loading from cache
  - Installing doctrine/doctrine-migrations-bundle (v1.3.1): Loading from cache
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing doctrine/orm (v2.5.14): Loading from cache
  - Installing symfony/orm-pack (v1.0.5): Loading from cache
  - Installing symfony/options-resolver (v3.4.4): Loading from cache
  - Installing symfony/polyfill-intl-icu (v1.7.0): Loading from cache
  - Installing symfony/intl (v3.4.4): Loading from cache
  - Installing symfony/form (v3.4.4): Loading from cache
  - Installing symfony/expression-language (v3.4.4): Loading from cache
  - Installing symfony/var-dumper (v3.4.4): Loading from cache
  - Installing symfony/phpunit-bridge (v3.4.4): Loading from cache
  - Installing twig/twig (v2.4.4): Loading from cache
  - Installing symfony/twig-bridge (v3.4.4): Loading from cache
  - Installing symfony/web-profiler-bundle (v3.4.4): Loading from cache
  - Installing symfony/twig-bundle (v3.4.4): Loading from cache
  - Installing symfony/stopwatch (v3.4.4): Loading from cache
  - Installing symfony/profiler-pack (v1.0.3): Loading from cache
  - Installing easycorp/easy-log-handler (v1.0.4): Loading from cache
  - Installing symfony/debug-bundle (v3.4.4): Loading from cache
  - Installing symfony/debug-pack (v1.0.4): Loading from cache
  - Installing symfony/asset (v3.4.4): Loading from cache
  - Installing sensio/framework-extra-bundle (v5.1.6): Loading from cache
  - Installing symfony/dom-crawler (v3.4.4): Loading from cache
  - Installing symfony/browser-kit (v3.4.4): Loading from cache
  - Installing symfony/css-selector (v3.4.4): Loading from cache
  - Installing symfony/dotenv (v3.4.4): Loading from cache
  - Installing symfony/maker-bundle (v1.1.1): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 20 recipes (2f96d696d346819d6ba100d95252f4e1)
  - Configuring symfony/flex (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/framework-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring doctrine/annotations (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/webpack-encore-pack (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/swiftmailer-bundle (>=2.5): From github.com/symfony/recipes:master
  - Configuring symfony/translation (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/security-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/monolog-bundle (>=3.1): From github.com/symfony/recipes:master
  - Configuring symfony/routing (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/console (>=3.3): From github.com/symfony/recipes:master
  - Configuring doctrine/doctrine-cache-bundle (>=1.3.2): From auto-generated recipe
  - Configuring doctrine/doctrine-bundle (>=1.6): From github.com/symfony/recipes:master
  - Configuring doctrine/doctrine-migrations-bundle (>=1.2): From github.com/symfony/recipes:master
  - Configuring symfony/phpunit-bridge (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/web-profiler-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/twig-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring easycorp/easy-log-handler (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/debug-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring sensio/framework-extra-bundle (>=4.0): From github.com/symfony/recipes:master
  - Configuring symfony/maker-bundle (>=1.0): From github.com/symfony/recipes:master
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!  In Kernel.php line 865:
!!                                                                                 
!!    Warning: unlink(/home/fmk/Code/test/var/cache/dev/ContainerS8fduda.legacy):  
!!     No such file or directory                                                   
!!                                                                                 
!!  
!! 

即使在调用php bin/console cache:clear时,我也会遇到同样的错误:

php bin/console cache:clear

In Kernel.php line 865:

  Warning: unlink(/home/fmk/Code/test/var/cache/dev/ContainerS8fduda.legacy): No such file or directory  

即使手动删除var/cache中的文件/文件夹,然后再次尝试清除缓存,错误也不会消失:

$ sudo rm -rf var/cache/*
$ php bin/console cache:clear

In Kernel.php line 865:

  Warning: unlink(/home/fmk/Code/test/var/cache/dev/ContainerS8fduda.legacy): No such file or directory

如果我尝试在应用程序中打开一个路径,我会收到与尝试呼叫cache:clear时抛出的路径相同的错误。

如果我尝试创建丢失的文件,则会抛出一个无法取消链接的新文件的新错误。这些是到目前为止出现的文件:

  • var/cache/dev/ContainerS8fduda.legacy
  • var/cache/de_
  • var/cache/de~
  • var/cache/de_/ContainerS8fduda.legacy
  • ...

我不知道还有什么可以让应用程序运行......

有谁知道如何解决这个问题?

谢谢!

更新 我创建了一个shell脚本来创建所有“缺失”的文件:

#!/bin/bash

rm -rf var/cache/*

mkdir var/cache/dev
touch var/cache/dev/ContainerToyerun.legacy
touch var/cache/dev/ContainerToyerun.legacy
touch var/cache/de~
mkdir var/cache/de_
touch var/cache/de_/ContainerToyerun.legacy

这使我能够针对应用程序发出一个请求,但之后ContainerToyerun.legacy文件有一个新名称,我需要编辑脚本以获取新请求!

3 个答案:

答案 0 :(得分:0)

我和Symfony v3.4.4有同样的问题 在此之前一切正常。 var/cache目录权限为 777 ,这意味着在我的情况下这不是文件权限问题。所以我删除了所有作曲家组件并再次安装它们,它解决了我的问题。

$ rm -rf vendor/* && composer install

希望它会帮助别人。

答案 1 :(得分:0)

删除供应商/并重新安装作曲家将无法解决问题, 该问题已解决,在您的php.ini(或20-xdebug.ini)中禁用了xdebug.scream,该符号链接到/ etc / php /(您的PHP版本)/mods-available/xdebug.ini )

答案 2 :(得分:0)

我建议您阅读此网站https://github.com/symfony/symfony/issues/26158 问题是由于 xdebug.scream = 1