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 issues with PHP 7.4 #2756

Closed
ArnCo opened this issue Dec 10, 2019 · 2 comments
Closed

Permission issues with PHP 7.4 #2756

ArnCo opened this issue Dec 10, 2019 · 2 comments

Comments

@ArnCo
Copy link

ArnCo commented Dec 10, 2019

Hi Grav team,

I just upgraded to PHP 7.4.0, and now have permission issues on my logs and doctrine directories.
Here's the stacktrace:

  | UnexpectedValueException: The stream or file "/usr/share/nginx/html/[redacted]/logs/grav.log" could not be opened: failed to open stream: Read-only file system in /usr/share/nginx/html/[redacted]/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:108
-- | --
  | Stack trace:
  | #0 /usr/share/nginx/html/[redacted]/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(39): Monolog\Handler\StreamHandler->write(Array)
  | #1 /usr/share/nginx/html/[redacted]/vendor/monolog/monolog/src/Monolog/Logger.php(344): Monolog\Handler\AbstractProcessingHandler->handle(Array)
  | #2 /usr/share/nginx/html/[redacted]/vendor/monolog/monolog/src/Monolog/Logger.php(470): Monolog\Logger->addRecord(500, 'The directory "...', Array)
  | #3 /usr/share/nginx/html/[redacted]/system/src/Grav/Common/Errors/Errors.php(61): Monolog\Logger->addCritical('The directory "...')
  | #4 /usr/share/nginx/html/[redacted]/vendor/filp/whoops/src/Whoops/Handler/CallbackHandler.php(50): Grav\Common\Errors\Errors->Grav\Common\Errors\{closure}(Object(InvalidArgumentException), Object(Whoops\Exception\Inspector), Object(Whoops\Run))
  | #5 /usr/share/nginx/html/[redacted]/vendor/filp/whoops/src/Whoops/Run.php(321): Whoops\Handler\CallbackHandler->handle(Object(InvalidArgumentException))
  | #6 [internal function]: Whoops\Run->handleException(Object(InvalidArgumentException))
  | #7 {main}

I use:

  • PHP 7.4.0 (cli) (built: Nov 30 2019 10:43:49) ( NTS )
  • PHP-FPM 7.4.0
  • Zend Engine v3.4.0, Copyright (c) Zend Technologies
  • Grav 1.6.19

The permissions are properly set on directories (775 +s) using the documentation's script, and rolling back to 7.3.8 fixed the problem.

Is there any fix that I missed ?

Kind regards,

ArnCo

@mahagr
Copy link
Member

mahagr commented Dec 11, 2019

This tells it all: failed to open stream: Read-only file system

So likely your server does not allow you to write to /usr folder, you will likely need to move the site to some other location, like /home/user/www to make it to work.

@ArnCo
Copy link
Author

ArnCo commented Dec 11, 2019

Hi @mahagr , thanks for your comment, it lead me to the cause of the issue.
Systemd unit for php-fpm 7.4 is hardened with sandboxing, more particularly, ProtectSystem is set to true, which forbids it to write to /usr, /boot and /etc.

I'm closing the issue.

Cheers,

ArnCo

@ArnCo ArnCo closed this as completed Dec 11, 2019
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

2 participants