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

Fatal error: Uncaught Runtime Exception #912

Closed
porfidev opened this issue Jun 21, 2016 · 12 comments
Closed

Fatal error: Uncaught Runtime Exception #912

porfidev opened this issue Jun 21, 2016 · 12 comments
Labels

Comments

@porfidev
Copy link

@porfidev porfidev commented Jun 21, 2016

Fatal error: Uncaught RuntimeException: Opening file for writing failed on error fopen(/var/www/html/music/grav/user/config/security.yaml): failed to open stream: Permission denied in /var/www/html/music/grav/vendor/rockettheme/toolbox/File/src/File.php:202 Stack trace: #0 /var/www/html/music/grav/vendor/rockettheme/toolbox/File/src/File.php(316): RocketTheme\Toolbox\File\File->lock() #1 /var/www/html/music/grav/system/src/Grav/Common/Config/Setup.php(250): RocketTheme\Toolbox\File\File->save(Array) #2 /var/www/html/music/grav/system/src/Grav/Common/Config/Setup.php(175): Grav\Common\Config\Setup->check(Object(RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator)) #3 /var/www/html/music/grav/system/src/Grav/Common/Grav.php(213): Grav\Common\Config\Setup->init() #4 /var/www/html/music/grav/index.php(38): Grav\Common\Grav->process() #5 {main} thrown in /var/www/html/music/grav/vendor/rockettheme/toolbox/File/src/File.php on line 202

Apache Server
Server version: Apache/2.4.6 (Red Hat Enterprise Linux)
Server built: Mar 21 2016 02:33:00

PHP Version
$ php -v
PHP 7.0.7 (cli) (built: May 28 2016 07:53:22) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Permissions
sudo chown -R apache:apache music/

tried all into https://learn.getgrav.org/troubleshooting/permissions

Grav version
You are already running the latest version of Grav (v1.0.10) released on Thu Feb 11 22:37:50 2016

Main Folder
var/www/html/music

Install intents

  • Zip + Composer install
  • Composer install
  • Git + Composer Install

Any Help Please??

@flaviocopes
Copy link
Contributor

@flaviocopes flaviocopes commented Jun 21, 2016

Grav cannot write to the /var/www/html/music/grav/user/config/ folder, so as you already guessed it's a permission issue.

Your permissions settings seem ok, if PHP is run as apache:apache

Loading

@porfidev
Copy link
Author

@porfidev porfidev commented Jun 21, 2016

yes it does;

<?php echo exec('whoami');

throws: apache

Extra info:

music folder
drwxrwxr-x. 3 apache apache 33 Jun 21 08:10 music

music/user/config
drwxrwxr-x. 2 apache apache 40 Jun 21 08:10 config

Loading

@flaviocopes
Copy link
Contributor

@flaviocopes flaviocopes commented Jun 21, 2016

I'm afraid I don't have an answer for this then. Searching on the Grav forum didn't bring up past occurrences of this problem

Loading

@porfidev
Copy link
Author

@porfidev porfidev commented Jun 22, 2016

FIXED !! 💃

The problem was SELinux, I ran this command

chcon -Rv --type=httpd_sys_rw_content_t . Into my Grav Folder.

references:

I love GRAV 🍡 PS. I´m on EC2 Instance 👍

Loading

@porfidev porfidev closed this Jun 22, 2016
@w00fz
Copy link
Member

@w00fz w00fz commented Jun 22, 2016

Nice, I never knew about the chcon command until now.

Loading

@flaviocopes
Copy link
Contributor

@flaviocopes flaviocopes commented Jun 22, 2016

@elporfirio care to add a line to https://learn.getgrav.org/troubleshooting/permissions about this? So others on SELinux with this same issue will find a quick answer

Loading

@porfidev
Copy link
Author

@porfidev porfidev commented Jun 22, 2016

@flaviocopes no problem, I'll document this.

Loading

@lokeshh
Copy link

@lokeshh lokeshh commented Feb 16, 2017

Somebody please document it. It was really frustrating solving this issue.

Loading

@flaviocopes
Copy link
Contributor

@flaviocopes flaviocopes commented Feb 17, 2017

Loading

@Zygodcatyl
Copy link

@Zygodcatyl Zygodcatyl commented Feb 18, 2018

Thank you, I was banging my head against a wall trying to figure this one out. I wonder why chmod and chown did not work.

Loading

@w3servicesdotnet
Copy link

@w3servicesdotnet w3servicesdotnet commented Feb 17, 2020

Me too facing same issue .. not able to find a solution.

Loading

@MaximKing1
Copy link

@MaximKing1 MaximKing1 commented Jul 13, 2021

I get this

chcon: invalid context: ‘system_u:object_r:httpd_sys_rw_content_t:s0’: No such file or directory
``` When running the command? Any ideas Ubuntu 20.04 LTS and PHP 8.0.8

Loading

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

Successfully merging a pull request may close this issue.

None yet
8 participants