Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run clear:cache in development mode #38

Open
d3vpunk opened this issue Aug 26, 2013 · 7 comments
Open

Unable to run clear:cache in development mode #38

d3vpunk opened this issue Aug 26, 2013 · 7 comments

Comments

@d3vpunk
Copy link

d3vpunk commented Aug 26, 2013

It's not possible to clear the cache of my symfony2 application. The PdfBundle internally uses some zf_cache with www-data rights (the user linux uses when you run your application in the browser.
In the console, you run the app/console with another user who is not able to delete the folder:

So it's not possible to delete the cache folder:

[UnexpectedValueException]
FilesystemIterator::__construct(/app/cache/dev_old/zfcache-fa): failed to open dir: Permission denied

@psliwa
Copy link
Owner

psliwa commented Aug 26, 2013

This is not PdfBundle issue but general symfony2 problem. Symfony2 cache is precreated by user who called app/console script but application runs on www-data account, so when some cache is creating while application runtime, permission denied error occurs.

There are some solutions: http://symfony.com/doc/current/book/installation.html#configuration-and-setup

I use umask function in first line of console script and app*.php files and it works ok.

@d3vpunk
Copy link
Author

d3vpunk commented Aug 27, 2013

Thanks for the fast reaction and this great bundle!

I know this solution but i think this not an elegant one. I read the your documentation and i'm apparently able to define cache options: https://github.com/psliwa/PdfBundle#configuration

I tried to define some zend cache related cache options but it didn't work for me: http://framework.zend.com/manual/1.12/en/zend.cache.backends.html

Isn't it possible to define some symfony2 friendly caching options as an intiial configuration of the bundle?

@truckee
Copy link

truckee commented Nov 10, 2013

In a shared host prod environment umask() (as suggested above) does not prevent an error on cache:clear similar to that of playr1983g.

@psliwa
Copy link
Owner

psliwa commented Nov 11, 2013

Probably you set this mask after cache was created. Umask doesn't work if cache is already created. You should clear cache one time manually (via delete cache/prod directory) and next time cache:clear should work ok.

@truckee
Copy link

truckee commented Nov 11, 2013

Piotr,

Thanks for your reply.  Such does not appear to be the case.  I removed the app/cache/prod directory, ran clear cache for prod environment command as user then created a pdf in prod environment.  The zfcache* directories return owned by www-data with no group or world rights.

Now trying (without much success) to create a controller to clear cache for prod environment.

George

UPDATE:
Now that I have a controller that can deal with the prod cache I no longer worry about www-data owned directories.

I very much appreciate your work here. I apologize for not being able to contribute - my work is as a volunteer for a non-profit.


From: Piotr Śliwa notifications@github.com
To: psliwa/PdfBundle PdfBundle@noreply.github.com
Cc: truckee truckeetrout@yahoo.com
Sent: Monday, November 11, 2013 7:15 AM
Subject: Re: [PdfBundle] Unable to run clear:cache in development mode (#38)

Probably you set this mask after cache was created. Umask doesn't work if cache is already created. You should clear cache one time manually (via delete cache/prod directory) and next time cache:clear should work ok.

Reply to this email directly or view it on GitHub.

@ricohumme
Copy link

Hi,

Problem hasn't been resolved yet, unfortunately. Still having issues with this.
I keep changing the access rights to the cache folder due to the zf-cache dirs.
Is there going to be a solution for this in the near future?

Best regards,
Rico

@bnlab
Copy link

bnlab commented Jun 7, 2018

Hi to the best pdf library.

In my case setting right permissions for zfcache library helped:

ps_pdf:
    ...
    cache:
        type: ~
        options:
            filePermission: 0660
            dirPermission: 0770
    ...

Using symfony 3.4,
Best regards,
Bart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants