ConsoleBundle icon indicating copy to clipboard operation
ConsoleBundle copied to clipboard

Cache:clear doesn't work

Open gnutix opened this issue 12 years ago • 15 comments

I'm having issues executing the cache:clear command with this bundle.

On my server :

Clearing the cache for the prod environment with debug true

  [Symfony\Component\Filesystem\Exception\IOException]                                                  
  Failed to remove directory /var/www/sites/my-website/app/cache/prod_old/sessions

Is it about webserver's user rights ?

In local :

[error] Internal Server Error

And here is what I find in the logs for the local error :

[2013-08-21 11:51:53] request.CRITICAL: Exception thrown when handling an exception (Symfony\Component\Debug\Exception\ContextErrorException: Warning: file_put_contents(/var/www/sites/my-website/app/cache/dev/annotations/Symfony-Bundle-TwigBundle-Controller-ExceptionController.cache.php): failed to open stream: No such file or directory in /var/www/sites/my-website/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php line 186) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException: Warning: file_put_contents(/var/www/sites/my-website/app/cache/dev/annotations/My-Bundle-Entity-MyEntityTranslation.cache.php): failed to open stream: No such file or directory in /var/www/sites/my-website/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php line 186 at /var/www/sites/my-website/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php:186)"}

Both commands work well from the command line. I'm using Symfony 2.3.3 and CoreSphereConsoleBundle 0.1.0.

gnutix avatar Aug 21 '13 09:08 gnutix

Any help would be welcomed !

gnutix avatar Sep 04 '13 10:09 gnutix

Hey, sorry for the late response.

Are you able to run the command via the real command line (ssh)? I suppose it is a permission problem.

laszlokorte avatar Sep 04 '13 13:09 laszlokorte

I can execute the command in the command line. But the user for the app/cache/* folders is not the same as the one I'm connected with (and that may indeed be the issue).

I'll try to ask the server admin guys about it.

gnutix avatar Sep 04 '13 14:09 gnutix

Assuming this is solved by now on the server you are using? I cannot reproduce it here.

jokey2k avatar Oct 06 '13 23:10 jokey2k

I'm not yet fixed about it, as the IT service is really... slow to interact with us (development). But I'll open the issue again if I'm in the need.

gnutix avatar Oct 07 '13 07:10 gnutix

hi ! i had the same issue. command with ssh works fine ( with root user ) but it doesn't work with the bundle but everything else works fine. any idea ?

umens avatar Dec 03 '13 01:12 umens

Have you giving chmod 777 permissions to the /app/cache/ and all it's (just for diagnosis reasons)?

It could be that if you have run cache:warmup via ssh the folders and files are created without write access for the user the webserver is running as. This would lead to the webserver not being able to modify the files afterwards.

laszlokorte avatar Dec 03 '13 01:12 laszlokorte

i gave chmod 777 permissions to the /app/cache/ and /app/log/ . I had never user the command cache:warmup ( is that a problem ? ) the weird thing is that le command erase almost entierly the cache folder but it remain one file. And i got this error on firebug. this is the file that remain.

image

umens avatar Dec 03 '13 09:12 umens

Could you try to create the app/cache/dev/annotations folder yourself? I could be that the error is not in this bundle but in the doctrine annotations.

laszlokorte avatar Dec 08 '13 04:12 laszlokorte

I the error occurred due to the --no-warmup flag which was automatically added to the cache:clear command when executed via web console. I forced this flag to prevent namespacing errors in earlier symfony versions but it seems to not necessary anymore.

Could you please try the current master branch?

laszlokorte avatar Dec 08 '13 06:12 laszlokorte

i updated to the current master and i got this error

image

i got a new directory in the cache folder : " de_ " the only folder which the update time change is profiler/ all the other don't change or are deleting.

by the way "cache:clear --no-optional-warmers" is working partially. (delete some folder but not all).

(sorry for my poor english :) and i really appreciate your help )

umens avatar Dec 08 '13 19:12 umens

Same problem here:

  [Symfony\Component\Filesystem\Exception\IOException]                                                  
  Failed to remove directory /var/www/sites/my-website/app/cache/dev_old/sessions

The "sessions" folder has 755 rights, and the right owner. If I delete it manually and run "cache:clear --no-warmup" it is created again and I get the same error. However, for production mode it works fine.

My config: coresphere/console-bundle dev-master 8666165 symfony/symfony v2.3.9 hosted on a Gandi Simple Hosting instance.

Hope this can help.

maximevenin avatar Jan 06 '14 13:01 maximevenin

Are you logged in during using the console? Could you try clearing the cache while being logged out?

laszlokorte avatar Jan 06 '14 17:01 laszlokorte

I was indeed logged in but logging out didn't change anything. The sessions folder is empty btw.

maximevenin avatar Jan 07 '14 07:01 maximevenin

Try running it like this: cache:clear --no-warmup

This works for me.

TomasVotruba avatar Aug 25 '15 10:08 TomasVotruba