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

log actual mkdir() failure reason #554

Closed
oadam opened this issue Dec 10, 2017 · 9 comments
Closed

log actual mkdir() failure reason #554

oadam opened this issue Dec 10, 2017 · 9 comments

Comments

@oadam
Copy link

oadam commented Dec 10, 2017

Configuration:

PhpFastCache version: 6.0.7
PHP version: 7.0.22-0ubuntu0.16.04.1
Operating system: ubuntu

Issue description:

I'm using the files driver in production. Most of the time everything is working fine, but sometimes mkdir fails for an unknown reason (I'm almost sure it's not a permission issue), and phpFastCache logs an unhelpful PLEASE CHMOD /mytmpdir - 511 OR ANY WRITABLE PERMISSION!

Would it be possible to update the file driver so that it returns the actual root cause ? A code similar to this (from https://stackoverflow.com/a/929490/436792) could be used :

if (!@mkdir($dir)) {
    $error = error_get_last();
    // use $error['message'];
}
@oadam oadam changed the title log actual mkdir() failure reason log actual mkdir() failure reason Dec 10, 2017
@Geolim4
Copy link
Member

Geolim4 commented Dec 10, 2017

The error is actually quite helpful. It's telling you that PFC can't write on the disk. There's multiple potentials causes:

  • No left space on disk
  • Not owner of the target directory
  • Incorrect chmod

I'm not sure that error_get_last() will return more pertinent information.

Cheers,
Georges

@Geolim4 Geolim4 self-assigned this Dec 10, 2017
@Geolim4 Geolim4 added the 6.0 label Dec 10, 2017
@oadam
Copy link
Author

oadam commented Dec 10, 2017 via email

@Geolim4
Copy link
Member

Geolim4 commented Dec 10, 2017

If there's an I/O issue, just check the php logs. That's simple, right ?

@oadam
Copy link
Author

oadam commented Dec 10, 2017 via email

@oadam
Copy link
Author

oadam commented Dec 10, 2017 via email

@Geolim4
Copy link
Member

Geolim4 commented Dec 10, 2017

The "@" should not be used at all in php, it's a very bad practice. Hiding the error does not solve them :)

@oadam
Copy link
Author

oadam commented Dec 10, 2017 via email

@Geolim4
Copy link
Member

Geolim4 commented Dec 10, 2017

I can indeed work on phpFastCacheIOException because this exception is thrown every time that we got a critical IO Exception.

Geolim4 added a commit that referenced this issue Dec 13, 2017
(cherry picked from commit eda7962)
Geolim4 added a commit that referenced this issue Dec 13, 2017
@Geolim4
Copy link
Member

Geolim4 commented Dec 13, 2017

If it's available, an additional information message will be appended to the Exception message.
Thanks for your report.

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

No branches or pull requests

2 participants