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

Permission error creating storage directory #37

Closed
mikeerickson opened this issue Jan 20, 2014 · 7 comments
Closed

Permission error creating storage directory #37

mikeerickson opened this issue Jan 20, 2014 · 7 comments

Comments

@mikeerickson
Copy link

I have confirmed the parent directory has correct privileges but still receive error? This is working with Slim framework

var_dump result --> string '/requests/storage/path' (length=22)

Slim Application Error
The application could not run because of the following error:

Details

Type: ErrorException
Code: 2
Message: mkdir(): Permission denied
File: /Users/mikee/Documents/Projects/slim-clockwork/vendor/itsgoingd/clockwork/Clockwork/Storage/FileStorage.php
Line: 26
Trace
#0 [internal function]: Slim\Slim::handleErrors(2, 'mkdir(): Permis...', '/Users/mikee/Do...', 26, Array)
#1 /Users/mikee/Documents/Projects/slim-clockwork/vendor/itsgoingd/clockwork/Clockwork/Storage/FileStorage.php(26): mkdir('/requests/stora...', 448, true)
#2 /Users/mikee/Documents/Projects/slim-clockwork/vendor/itsgoingd/clockwork/Clockwork/Support/Slim/ClockworkMiddleware.php(32): Clockwork\Storage\FileStorage->__construct('/requests/stora...')
#3 /Users/mikee/Documents/Projects/slim-clockwork/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Clockwork\Support\Slim\ClockworkMiddleware->call()
#4 /Users/mikee/Documents/Projects/slim-clockwork/vendor/slim/slim/Slim/Slim.php(1261): Slim\Middleware\PrettyExceptions->call()
#5 /Users/mikee/Documents/Projects/slim-clockwork/public/index.php(40): Slim\Slim->run()
#6 {main}

@itsgoingd
Copy link
Owner

Hey, you need to pass a valid path to the middleware constructor.

For example if I had my index.php file with Slim initialisation in a /public subdir and wanted to store Clockwork metadata in /clockwork, I would initialise it like this:

$app->add(new Clockwork\Support\Slim\ClockworkMiddleware(__DIR__ . '/../clockwork'));

@mikeerickson
Copy link
Author

I have made this change and no more permissions errors (thanks for recommendation)

However, now when I attempt to log something simple nothing appears (even after manual refresh with clockwork pane displayed)

I have no problems using with Laravel framework, issue only seems with slim

So you have a sample app using slim by chance? Or some sample code you can share. Not quite sure why it's not working

@itsgoingd
Copy link
Owner

Hey, please try the latest dev-master version, Clockwork is now shared via Slim's DI container, so you can access all Clockwork methods like this $app->clockwork->startEvent(...). Log messages logged via Slim are now also automatically shown in Clockwork.

@paulschneider
Copy link

Afternoon,

I "installed" Clockwork this morning and ran into trouble (bear with me here) with GitHub (the OSX git client, https://mac.github.com). I reported to GitHub that I was no longer able to commit and push any changes to a repo. On their advise to look at the console logger I noticed an error which ultimately said:

Failed to open directory .... app/storage/clockwork/ Permission denied.

Checking the directory I see that the installation process had not set the permissions and had set the owner to _www. Not sure why this affected GitHub but I've let them know as they'll need to handle this their end as well I think.

I guess this is related to this thread so I'll post here. Happy to move it if its not the right place.

Awesome plug in by the way...Nice work.

@itsgoingd
Copy link
Owner

Hey,

I'd suggest you don't rely on Clockwork to create the storage directory and instead create it yourself with appropriate permissions. When Clockwork creates the directory, it's created under the user which runs the php script (www in your case), and disables all permissions for all other users for security reasons (so other users can't access your Clockwork files in shared-hosting environment for example).

Thanks!

@younes0
Copy link

younes0 commented Jun 25, 2018

Clockwork is enabled as middleware but I'm unable to use it for logging variables.
$app->clockwork->info('test'); results in Identifier "clockwork" is not defined.

@devopsmica
Copy link

This is still an issue for me. My user is part of the www-data group and need to be able to delete the folder (I keep three copies of the site with my CI that deploy my site).

I don't want to run anything as sudo with my deployer user, so it should be able to delete de folder as being part of the www-data group.

Is there anywhere I can setup that? Thanks

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