Frequent error: file_get_contents(): read of 8192 bytes failed with errno=13 Permission denied

Hi,
I’m frequently getting this error in the admin section, e.g. when saving a page. It started since the last Grav update (Grav v1.7.34 - Admin v1.10.34) though I don’t know if that’s related. Any ideas? Should I open an issue on Github?

Thanks!

@yankl, Since it only happens when using Admin, I would suggest to open an issue at the Admin repo.

Thanks for your advice! Actually, I see someone has already opened an issue there:

There are 325 open issues currently in Admin.

@hughbris + 341 open for Core + ?? for plugins and themes. And I think they are already busy with v1.8.0-dev. Tough job for only 3 devs…

1 Like

Just saying don’t expect any resolution quickly. You might get lucky on Discord.

Hi all,
I have been trying to work out this one, since upgrading on the day it came out.

On the github entry listed, I have added as much info as possible, but as of tonight I think I have a solution updated on the github issue.

Thought it was an admin / plugin issue at the start but it relates to grav 1.7.34 and the php version you are using.

You can get by, by refresh your browser page every time the error comes up (way to break things is simply change the template in the advanced tab to a different template and save) press f5 / ctrl r to reload the page.

I had to roll back to use php 7.3.9 and enable reverse proxy lookup in the system.yaml (due to feed and admin / ajax errors)

So if you using php 7.4 or 8.x then stick with 1.7.33 of grav , if you want 1.7.34 , downgrade your php.

Now after figuring that out over the weekend … I am going to bed… peace out ! lol

Hi, change the permission of the user folder, remove read only on the filesystem

I got this file_get_contents() error on my first attempt at saving a file that I edited. I’m a retired developer, so I can deal with some technical problems, but it’s been quite a while since I was coding full time. All I want to do now is modernize a very small real estate site for my rental property. After looking for simple website builders, I decided to try grav.

To get around this particular problem, running the built-in grav web server on Windows 10, and with cygwin installed, I tried using chmod to make all the files under user readable and writeable by group and other. I also tried using the Windows File Explorer to give Full Control to all users. None of that made a difference. (By the way, I have Apache installed on my Windows computer, but I have not yet tried to use grav with Apache.)

Tell me if I’m wrong about this: If I want to use grav, I probably will need to set up a Linux virtual machine on my Windows computer so various errors can be resolved with solutions posted by Linux developers. I also will have to work through a series of errors like this one. Also, I will need to download grav 1.7.33, but I don’t know how to get that in a zip file like the one I have, which is 1.7.35. I am only slightly familiar with github, so if the only way to get 1.7.33 is to pull all the source code, then I will need to learn github and, maybe, set up some kind of build environment. Then, because I don’t know Markdown, I may need to learn that, too, for some file editing that perhaps goes beyond what the admin tool supports. All this to get, basically, a real estate site with a better photo viewer than what I have now.

Am I being too pessimistic?

Funny post, but perhaps a bit exaggerated. :wink:

Have you tried upgrading to the latest version of PHP? That didn’t totally eliminate the error for me but I’m getting it much less frequently now.

Also, at least in my case, the error was more of an annoyance than anything else — it didn’t prevent the functioning of anything; once I pressed refresh, the action I had tried to initiate seemed to have executed correctly.

FWIW the author seems pretty certain this isn’t actually a grav bug: **SOLVED** >1.7.34 - admin file_get_contents() permission denied error - windows and php 8.18 and below · Issue #2299 · getgrav/grav-plugin-admin · GitHub

I have the same annoying problem.

Today I updated three different websites to Grav 1.7.35 on my local installation (XAMPP, PHP 7.4.14, Win 10). Everytime I wanted to save a page using Admin, I get the error message “file_get_contents(): read of 8192 bytes failed”. Very annoying, because I prefer to edit my websites locally.

Thanks to this post I’ve found the following solution suggested on Github. Even though PHP seems to be the culprit, why were there no such problems until Grav 1.7.34?

I’m not a computer newbie, but the suggested solution is not so easy to implement. The latest version of XAMPP only supports PHP 8.1.6. Updating to the required PHP version 8.1.9 unfortunately is not an easy task for me and probably for many other Grav users.

I hope there is another simpler solution. I am looking forward to a next version of Grav that works as flawlessly as I am used to.

I also have the same annoying problem, so when i develop on windows before going in production i solve the problem adding this at /index.php
after \define(‘GRAV_PHP_MIN’, ‘x.x.x’);

if ( $_SERVER['SERVER_NAME'] == "mydeveldomain" ) {
    $errlev = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_NOTICE & ~E_STRICT;
    error_reporting($errlev);
}

this way php e_notice are disabled and no exception are thrown

This issue has been resolved with a temp fix, and incorporated in to 1.7.37.1 , So all should be good now !