Grav: Fatal error: Uncaught Runtime Exception

Created on 21 Jun 2016  路  11Comments  路  Source: getgrav/grav

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??_

question

Most helpful comment

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 馃憤

All 11 comments

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

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

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

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 馃憤

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

@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

@flaviocopes no problem, I'll document this.

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

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.

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

Was this page helpful?
0 / 5 - 0 ratings