Pim-community-dev: Cannot rename app/cache/prod to app/cache/prod~

Created on 8 Jun 2017  ·  6Comments  ·  Source: akeneo/pim-community-dev

I'm reporting a Bug

version: 1.7

How to reproduce

1) Create a new database
2) Point a working akeneo instance to new database by modifying parameters.yml
3) Run php5.6 app/console cache:clear --env=prod

root@1530c3ef6368:/var/www/pim-community-standard# php5.6 app/console cache:clear --env=prod
Clearing the cache for the prod environment with debug false


  [Symfony\Component\Filesystem\Exception\IOException]                                                                 
  Cannot rename "/var/www/pim-community-standard/app/cache/prod" to "/var/www/pim-community-standard/app/cache/pro~".  


cache:clear [--no-warmup] [--no-optional-warmers]

current workaround

manually do the renaming

root@1530c3ef6368:/var/www/pim-community-standard# mv app/cache/prod app/cache/prod~
root@1530c3ef6368:/var/www/pim-community-standard# php5.6 app/console cache:clear --env=prod
Clearing the cache for the prod environment with debug false
root@1530c3ef6368:/var/www/pim-community-standard#
question

Most helpful comment

@damien-carcel , we see in the console that it is run as root. I would suggest to simply not run Symfony commands as root. It is the best way to wreck a lot of permissions.
Not even talking about composer as root. :wink:

All 6 comments

Hello @QwertyZW,

I can't reproduce this bug.
Do you still use your docker image? Can you check you have writing rights on app/cache and app/logs directories?

Mickaël

Yep, I still have the image

root@0def23d23eb3:/var/www/pim-community-standard# php5.6 app/console cache:clear --env=prod
Clearing the cache for the prod environment with debug false


  [Symfony\Component\Filesystem\Exception\IOException]                                                                 
  Cannot rename "/var/www/pim-community-standard/app/cache/prod" to "/var/www/pim-community-standard/app/cache/pro~".  


cache:clear [--no-warmup] [--no-optional-warmers]

root@0def23d23eb3:/var/www/pim-community-standard# ls -la app/cache/
total 20
drwxr-xr-x  7 root root 4096 Jun  8 22:49 .
drwxr-xr-x 12 root root 4096 Jun  8 22:48 ..
drwxr-xr-x 12 root root 4096 Jun  8 22:48 dev
drwxr-xr-x 10 root root 4096 Jun  8 22:49 pro_
drwxr-xr-x 66 root root 4096 Jun  8 22:48 prod
root@0def23d23eb3:/var/www/pim-community-standard#

Hello @QwertyZW.

This kind of issue is usually related to permission (nothing to do with Docker, in fact it already happens to me on my local machine). For the PIM to work correctly, you have to use the same user to execute your commands than to run the apache server.

I guess that you Apache server is run by user www-data (the default Apache user), but that you ran app/console cache:clear with another user. Can you confirm (or not) my hint?

That is why we recommend to configure in our documentation to set your current user as Apache user. This is of course for development purpose and not recommended for production server (as the current server could have to much permissions).

If you really want to stick with www-data as Apache user, just be sure to run your app/console commands as www-data, and everything will be fine.

Regards,
Damien

@damien-carcel , we see in the console that it is run as root. I would suggest to simply not run Symfony commands as root. It is the best way to wreck a lot of permissions.
Not even talking about composer as root. :wink:

Hi @QwertyZW

Did you find answers to your questions?
If so, can we close this issue?

Thanks!

@jmleroux It's a docker container, it's ok to be running as root within a container.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gotgelf picture gotgelf  ·  5Comments

lpxavi picture lpxavi  ·  3Comments

Piotr-Borek picture Piotr-Borek  ·  5Comments

henryktews picture henryktews  ·  4Comments

ewallteam picture ewallteam  ·  6Comments