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

**SOLVED** >1.7.34 - admin file_get_contents() permission denied error - windows and php 8.18 and below #2299

Closed
spamhater-grav opened this issue Jun 19, 2022 · 46 comments

Comments

@spamhater-grav
Copy link

More for informative reasons, as need to test and truly replicate but finding this error has occurred (PHP 8.1.7 and fresh grav 1.7.34)

When the user login in to admin on a localhost test server (running php , not a web server)

image

Presume there is a little cache issue , when logging in to admin , I get the above error after accepting login and trying to display the dashboard, simply resolved by pressing the F5 key to refresh the browser window.

@spamhater-grav
Copy link
Author

Seems to be a composer cache issue, not limited to grav but seen with laravel

https://stackoverflow.com/questions/63063990/laravel-errorexception-hash-file-read-of-8192-bytes-failed-with-errno-13-pe

seems to be composer getting a bit greedy on memory
https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors

bit drastic having to set the php memory limit to -1 , but will try and increase and see in php and see if I can find a happy number

@spamhater-grav
Copy link
Author

spamhater-grav commented Jun 19, 2022

So did a fresh php , enable extensions , downloaded and placed the latest symfonycli and then a fresh clean copy of grav, brought up login / account creation page, on submit the error occurred
hit f5 refreshed and things seem to work alright, then went to the theme directory , the same error appears , then trying to save an existing page.

So its something a little bit more deeper that I first thought.

C:\portgrav\grav\vendor\rockettheme\toolbox\File\src\AbstractFile.php
     *
     * @return bool
     */
    public function writable()
    {
        if (null === $this->filename) {
            return false;
        }
 
        return $this->exists() ? is_writable($this->filename) : $this->writableDir(dirname($this->filename));
    }
 
    /**
     * (Re)Load a file and return RAW file contents.
     *
     * @return string
     */
    public function load()
    {
        $this->raw = null !== $this->filename && $this->exists() ? (string) file_get_contents($this->filename) : '';
        $this->content = null;
 
        return $this->raw;
    }
 
    /**
     * Get/set raw file contents.
     *
     * @param string $var
     * @return string
     */
    public function raw($var = null)
    {
        if ($var !== null) {
            $this->raw = (string) $var;
            $this->content = null;
        }
 
        if (!is_string($this->raw)) {
            $this->raw = $this->load();
Arguments
"file_get_contents(): Read of 8192 bytes failed with errno=13 Permission denied"


Whoops\Exception\ErrorException thrown with message "file_get_contents(): Read of 8192 bytes failed with errno=13 Permission denied"

Stacktrace:
#64 Whoops\Exception\ErrorException in C:\portgrav\grav\vendor\rockettheme\toolbox\File\src\AbstractFile.php:264
#63 file_get_contents in C:\portgrav\grav\vendor\rockettheme\toolbox\File\src\AbstractFile.php:264
#62 RocketTheme\Toolbox\File\AbstractFile:load in C:\portgrav\grav\vendor\rockettheme\toolbox\File\src\AbstractFile.php:284
#61 RocketTheme\Toolbox\File\AbstractFile:raw in C:\portgrav\grav\system\src\Grav\Common\File\CompiledFile.php:143
#60 Grav\Common\File\CompiledJsonFile:save in C:\portgrav\grav\system\src\Grav\Framework\Flex\FlexIndex.php:793
#59 Grav\Framework\Flex\FlexIndex:updateIndexFile in C:\portgrav\grav\system\src\Grav\Common\Flex\Types\Pages\PageIndex.php:101
#58 Grav\Common\Flex\Types\Pages\PageIndex:loadEntriesFromStorage in C:\portgrav\grav\system\src\Grav\Framework\Flex\FlexDirectory.php:999
#57 Grav\Framework\Flex\FlexDirectory:loadIndex in C:\portgrav\grav\system\src\Grav\Framework\Flex\FlexDirectory.php:405
#56 Grav\Framework\Flex\FlexDirectory:getIndex in C:\portgrav\grav\system\src\Grav\Framework\Flex\FlexDirectory.php:378
#55 Grav\Framework\Flex\FlexDirectory:getCollection in C:\portgrav\grav\user\plugins\flex-objects\flex-objects.php:709
#54 Grav\Plugin\FlexObjectsPlugin:onAdminMenu in C:\portgrav\grav\vendor\symfony\event-dispatcher\EventDispatcher.php:264
#53 Symfony\Component\EventDispatcher\EventDispatcher:doDispatch in C:\portgrav\grav\vendor\symfony\event-dispatcher\EventDispatcher.php:239
#52 Symfony\Component\EventDispatcher\EventDispatcher:callListeners in C:\portgrav\grav\vendor\symfony\event-dispatcher\EventDispatcher.php:73
#51 Symfony\Component\EventDispatcher\EventDispatcher:dispatch in C:\portgrav\grav\system\src\Grav\Common\Grav.php:592
#50 Grav\Common\Grav:fireEvent in C:\portgrav\grav\user\plugins\admin\admin.php:695
#49 Grav\Plugin\AdminPlugin:onTwigSiteVariables in C:\portgrav\grav\vendor\symfony\event-dispatcher\EventDispatcher.php:264
#48 Symfony\Component\EventDispatcher\EventDispatcher:doDispatch in C:\portgrav\grav\vendor\symfony\event-dispatcher\EventDispatcher.php:239
#47 Symfony\Component\EventDispatcher\EventDispatcher:callListeners in C:\portgrav\grav\vendor\symfony\event-dispatcher\EventDispatcher.php:73
#46 Symfony\Component\EventDispatcher\EventDispatcher:dispatch in C:\portgrav\grav\system\src\Grav\Common\Grav.php:592
#45 Grav\Common\Grav:fireEvent in C:\portgrav\grav\system\src\Grav\Common\Twig\Twig.php:413
#44 Grav\Common\Twig\Twig:processSite in C:\portgrav\grav\system\src\Grav\Common\Service\OutputServiceProvider.php:36
#43 Grav\Common\Service\OutputServiceProvider:Grav\Common\Service\{closure} in C:\portgrav\grav\vendor\pimple\pimple\src\Pimple\Container.php:122
#42 Pimple\Container:offsetGet in C:\portgrav\grav\system\src\Grav\Common\Processors\RenderProcessor.php:40
#41 Grav\Common\Processors\RenderProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#40 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#39 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\DebuggerAssetsProcessor.php:38
#38 Grav\Common\Processors\DebuggerAssetsProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#37 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#36 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\PagesProcessor.php:112
#35 Grav\Common\Processors\PagesProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#34 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#33 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\TwigProcessor.php:38
#32 Grav\Common\Processors\TwigProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#31 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#30 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\AssetsProcessor.php:39
#29 Grav\Common\Processors\AssetsProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#28 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#27 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\SchedulerProcessor.php:40
#26 Grav\Common\Processors\SchedulerProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#25 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#24 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\BackupsProcessor.php:39
#23 Grav\Common\Processors\BackupsProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#22 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#21 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\TasksProcessor.php:69
#20 Grav\Common\Processors\TasksProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#19 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#18 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\user\plugins\admin\classes\plugin\Router.php:65
#17 Grav\Plugin\Admin\Router:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#16 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#15 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\RequestProcessor.php:64
#14 Grav\Common\Processors\RequestProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#13 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#12 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\ThemesProcessor.php:38
#11 Grav\Common\Processors\ThemesProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#10 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#9 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\PluginsProcessor.php:39
#8 Grav\Common\Processors\PluginsProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#7 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#6 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Processors\InitializeProcessor.php:130
#5 Grav\Common\Processors\InitializeProcessor:Grav\Common\Processors\{closure} in C:\portgrav\grav\system\src\Grav\Common\Debugger.php:546
#4 Grav\Common\Debugger:profile in C:\portgrav\grav\system\src\Grav\Common\Processors\InitializeProcessor.php:131
#3 Grav\Common\Processors\InitializeProcessor:process in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:50
#2 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Framework\RequestHandler\Traits\RequestHandlerTrait.php:62
#1 Grav\Framework\RequestHandler\RequestHandler:handle in C:\portgrav\grav\system\src\Grav\Common\Grav.php:307
#0 Grav\Common\Grav:process in C:\portgrav\grav\index.php:47
_base | "C:\portgrav"
-- | --
_grav | "grav"
_gravdir | "C:\portgrav\grav"
_pages | "C:\portgrav\grav\user\pages"
_php | "php8.1"
_phpdir | "C:\portgrav\php8.1"
_themes | "C:\portgrav\grav\user\themes"
_user | "C:\portgrav\grav\user"
SYMFONY_TUNNEL_ENV | ""
SYMFONY_DOCKER_ENV | ""
SYMFONY_TUNNEL | ""
PHP_BINARY | "C:\portgrav\php8.1\php.exe"
PHP_PATH | "C:\portgrav\php8.1\php.exe"
PHP_PEAR_PHP_BIN | "C:\portgrav\php8.1\php.exe"
SYMFONY_DEFAULT_ROUTE_HOST | "127.0.0.1:8000"
SYMFONY_PROJECT_DEFAULT_ROUTE_PATH | "/"
HTTP_SEC_CH_UA_MOBILE | "?0"
SERVER_PORT | "8000"
SYMFONY_DEFAULT_ROUTE_SCHEME | "https"
HTTPS | "On"
SYMFONY_APPLICATION_DEFAULT_ROUTE_URL | "https://127.0.0.1:8000/"
HTTP_COOKIE | "gp-premium=1; grav-admin-flexpages=eyJyb3V0ZSI6Ii9ob21lIiwiZmlsdGVycyI6e319; grav-site-4c6fff7=rlal2hfk6iap5rbma6118v2ok9; grav-site-4c6fff7-admin=bn10jnpiir755 ▶"
QUERY_STRING | ""
HTTP_SEC_FETCH_MODE | "navigate"
SYMFONY_APPLICATION_DEFAULT_ROUTE_HOST | "127.0.0.1:8000"
SYMFONY_DEFAULT_ROUTE_URL | "https://127.0.0.1:8000/"
HTTP_SEC_FETCH_USER | "?1"
X_FORWARDED_PORT | "8000"
REMOTE_PORT | "7483"
SCRIPT_NAME | "/index.php"
REQUEST_URI | "/admin/themes"
HTTP_SEC_CH_UA | ""Google Chrome";v="105", ")Not;A=Brand";v="8", "Chromium";v="105""
SYMFONY_PROJECT_DEFAULT_ROUTE_SCHEME | "https"
SERVER_NAME | "localhost:8000"
HTTP_ACCEPT_ENCODING | "gzip, deflate, br"
HTTP_REFERER | "https://localhost:8000/admin/pages/home"
SYMFONY_DEFAULT_ROUTE_PATH | "/"
DOCUMENT_URI | "/index.php"
HTTP_ACCEPT | "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
HTTP_USER_AGENT | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"
SYMFONY_PROJECT_DEFAULT_ROUTE_URL | "https://127.0.0.1:8000/"
HTTP_SEC_CH_UA_PLATFORM | ""Windows""
SCRIPT_FILENAME | "C:\portgrav\grav\index.php"
REMOTE_ADDR | "::1"
REQUEST_METHOD | "GET"
HTTP_UPGRADE_INSECURE_REQUESTS | "1"
SYMFONY_PROJECT_DEFAULT_ROUTE_HOST | "127.0.0.1:8000"
SYMFONY_APPLICATION_DEFAULT_ROUTE_SCHEME | "https"
PATH_INFO | ""
CONTENT_TYPE | ""
CONTENT_LENGTH | ""
HTTP_SEC_FETCH_DEST | "document"
HTTP_HOST | "localhost:8000"
HTTP_MOD_REWRITE | "On"
DOCUMENT_ROOT | "C:\portgrav\grav\"
HTTP_SEC_FETCH_SITE | "same-origin"
SYMFONY_DEFAULT_ROUTE_PORT | "8000"
REDIRECT_STATUS | "200"
GATEWAY_INTERFACE | "CGI/1.1"
SYMFONY_APPLICATION_DEFAULT_ROUTE_PORT | "8000"
SERVER_SOFTWARE | "Symfony Local Server 5.4.8"
SYMFONY_APPLICATION_DEFAULT_ROUTE_PATH | "/"
SYMFONY_PROJECT_DEFAULT_ROUTE_PORT | "8000"
SERVER_PROTOCOL | "HTTP/2.0"
HTTP_ACCEPT_LANGUAGE | "en-GB,en-US;q=0.9,en;q=0.8"
FCGI_ROLE | "RESPONDER"
PHP_SELF | "/index.php"
REQUEST_TIME_FLOAT | 1655658072.0399
REQUEST_TIME | 1655658072

Noticed this above

REMOTE_ADDR | "::1"

I dont have Ip6 enabled would this cause an issue

@yankl
Copy link
Contributor

yankl commented Jun 20, 2022

I'm also experiencing this frequently on my localhost since the last Grav/admin upgrade (though don't know that it's related):
Grav v1.7.34 - Admin v1.10.34
PHP 7.4.19
Windows NT 10.0 build 19044 AMD64

@spamhater-grav
Copy link
Author

Glad to hear its not just me then lol. Yep seems to started with a 1.7.34 .. but with saying you are running running php 7.4 looks like either a particular php setting or the admin plugin / grav core. But with my setting up a fresh copy of php and grav and the symfony-cli with nothing clever set, just the required parameters, but it does happen over and over again when performing update of pages, admin login, all resolved by a F5 on the browser .. but slightly annoying lol

@nvandelden
Copy link

I'm also experiencing this error while trying to save a change made in Admin after updating Grav to v1.7.34 and Admin v1.10.34 on PHP 8.0.20.

@rhukster
Copy link
Member

jus to confirm are all you guys on windows ???

@nvandelden
Copy link

Yes, I'm on Windows 10 Pro build 19044.

@spamhater-grav
Copy link
Author

spamhater-grav commented Jun 24, 2022

Yep on windows and also have a linux / ubuntu machine.

I thought I might have solved it due to seeing an old post by matias in a gantry conversation,
He referred to a permission issue, so made sure, that I used an elevated command window (cmd.exe) to run php bin/grav server I thought it cured it, but then it started to play up again, when changes simple option in the admin of pages and settings.

Will try again, with a clean install. For me this problem only occurred from the last 1.7.34 update.

I have gone back to using 1.7.33 in the meantime , just to keep going and let my brain have a think what could be wrong.
Fresh install, and maybe run it from powershell rather the windows cmd prompt

Yep windows is the version that is causing me grief . Ran as small portable configuration with a cmd file , and fresh php install.

I did notice that on ubuntu when I set it up, the php.ini automatically has memory = -1 , where windows php has it set to 128M , and I set it 2048M , so that is another test, to try.

But it seems a permission issue or reading a file as a directory or vice versa.

Video of the error being invoked by simply change the template from the advanced / admin panel
grav-error-spamhater.zip

Thank Andy

*tested with
php 8.17 (NTS - VC16 ) x64 windows
php 8.1.2 NTS VC19 X64 and X32
php 7.4.27 x64 and X32 VC19

grav-error-spamhater.zip

Increased the memory of PHP to -1 and recorded this little vid, showing the error in action

@spamhater-grav
Copy link
Author

Further to a lot more reading and experimenting

I have now concluded this is not a grav admin issue, its more of grav core compatibility issue

I have tested the following combinations

Grav 1.7.33 on PHP 8.1 and 7.4 , works no issue

Grav 1.7.33 with the 1.7.34 compatible plugin updates on n PHP 8.1 and 7.4 , works no issue

Grav 1.7.34 full on PHP 7.3.9 X86 and X64 - NO ISSUES

So a compatibly issues with PHP 7.4 OR 8.1 x86 / x64
As soon as you go php.7.4 or php 8.1 (not physically tested on php8.0)

So @nvandelden and @yankl try dropping to php 7.3.9 and let us know on here, if that resolves the issue

@rhukster - I hope this gives you some sort of clue . Thank you Not sure if you want me to cross post this issue in to the grav core folder

@spamhater-grav
Copy link
Author

spamhater-grav commented Jun 27, 2022

Dam it.. its does break something tho , Keep getting red messages , regarding the dash board, and notifications etc , but too tired to look at this any further, at least it doesn't break with an an exception error. Or go back to Grav 1.7.33

image
I presume I can just turn the notifcation of in the admin plugin

This is something that has reported and been solved but that was in a forward direction, rather this backwards step of downgrading php (Ajax Error - Invalid Ajax Response) and https errors,

getgrav/grav@9b445ac

But a quick fix was to set reverse proxy look up to enabled in the system.yaml

Not telling you how to sucks eggs. but this is a useful resource for a quick virtual box for ie / edge testing, in various flavours
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ if you need to test further.

@spamhater-grav
Copy link
Author

spamhater-grav commented Aug 10, 2022

I can gladly confirm this was nothing at all to do with GRAV and GRAV-ADMIN or windows permissions. This fault is caused by PHP 8.1.x until PHP 8.1.9 was released on the 04/08/22.

I have now tested GRAV 1.7.34 and 1.7.35 with PHP releases >8.x and 8.1.8 - and the error occurs.

After further research other PHP based system had been reporting a similar error which did point to a PHP incompatibility / bug , as this is a standard procedure call and seemed to limited to Windows Only Systems)

With the release of php 8.1.9 (4 Aug 22) A fix seem to finally resolved this issue on Windows systems (this has taken a long time to be confirmed fixed and implemented)

SOLUTION

Install / Upgrade your PHP to 8.1.9 minimum for PHP 8.x compatibility with Grav

Tested over a couple of days on a fresh install of Grav 1.7.35 and PHP 8.1.9. **WORKING - NO ERROR **

Further reverse testing to find / prove where this bug / issue has come from and can be reproduced.

@spamhater-grav spamhater-grav changed the title 1.7.34 - login in to admin - file_get_contents() permission denied error - windows **SOLVED** >1.7.34 - admin file_get_contents() permission denied error - windows and php 8.18 and below Aug 10, 2022
@yankl
Copy link
Contributor

yankl commented Aug 11, 2022

@spamhater-grav I tried your solution and upgraded today to PHP 8.1.9. However, I still got the error. It was on Grav v1.7.35 but not a fresh install.

@spamhater-grav
Copy link
Author

spamhater-grav commented Aug 11, 2022

@yankl , I have had it once today, but this was my mucking about with my testing stuff, and I think you might get it to occur on an existing install due to cache issue, as on a old 1.7.34 site I hadn't clear the cache on that grav session completely.

It appeared once, at login, but since then clearing cache and temps files (windows / php / grav) clearing them all , from top to bottom, it hasn't occurred since, so maybe the key is the fresh install .

So it was due to me chopping and changing and testing different gravs, and under different php's.
Also make sure that the php server is killed and that your 8.1.9 is overriding.

Delete all the contents of /grav/cache directory. I have reopened for you yankly, just in case of problem.

Suggestion , make a new grav 1.7.35 directory, set it up / admin-ize it , and view site, view admin ... etc and test clean, then just move your existing user directory across to the new install and try like that. :)

@rhukster
Copy link
Member

This is DEFINITELY a windows PHP 8.1 issue. It's not a Grav issue because we're just using core PHP functions, nothing has changed on our side, and it works fine in other platforms and versions of PHP.

Feel free to keep this open to track things, but there's nothing we can do on our side.

@spamhater-grav
Copy link
Author

spamhater-grav commented Aug 11, 2022

Yep... deffo @rhukster

I am just saying what the test environment was when this was irradiated, its taken them (PHP) about 6 months to sort (windows.php.net that is) they refer to a problem with file locking in their fix. :) and other php platforms have had the same issue .

As soon as I can close it I will do, as I know that since the release of the update 4 days ago (PHP that is - even tho it was coincident that Grav 1.7.35 was released on the same day.. it resolved it straight away)

@yankl
Copy link
Contributor

yankl commented Aug 11, 2022

@spamhater-grav I appreciate very much your investigations! I thought of clearing the cache right after writing my last message, and then did so. Hopefully that will have solved it. You can probably reclose the issue, as there's nothing to be done on Grav to solve it.. just wanted to keep track here in case anyone is watching and can be helped. If I keep getting it for a while I'll renotify. Thanks again!

@spamhater-grav
Copy link
Author

Good to hear. We can lay this one to bed :) THIS IS NOT A GRAV ISSUE - THIS IS A PHP ISSUE. Grav dev team thanks for the support and the clarity :)

IF YOU ARE READING THIS

  • UPGRADE TO WINDOWS PHP 8.1.9 min
  • CLEAR YOUR CACHE WITH GRAV / PHP / TEMP FILES (if you are using an existing grav install)

PROBLEM SOLVED :)

@mdestafadilah
Copy link

Please open, it's not clear.

@CunoVoll
Copy link

CunoVoll commented Sep 2, 2022

I would also be happy if this thread is reopened and the "SOLVED" is questioned. I have the same annoying problem with Grav 1.7.35 on PHP 7.4.14 (Xampp on Win 10). I have posted details in the Grav forum.

@JasperCiti
Copy link

I agree. Upgrading PHP did not solve it for me. However I only see this error on Windows.

@mdestafadilah
Copy link

Yes, I have server ubuntu with Grav 1.7.35 (latest), once show, just chown/ chmod is clear, but in dev stage (windows 10) ... it's sometimes show, i'm clear cache and refresh it's oke, sometimes show again. and... not problem what's your php version. Thanks @CunoVoll , i follow grav forum too.

@spamhater-grav
Copy link
Author

spamhater-grav commented Sep 3, 2022

Hi all, I have reopened this to try and get it resolved for people personal issues.
What We Know - This is not a Grav issue , is will due to an environment setup issue on WINDOWS based machines. The code that fails , has been part of the Rocket theme toolbox and if it was Grav, it would fail on all environments, which it does not.

I will try and help you as much as I can, I will also replicate your setup as portable version, but without a Apache Stack at first, to test and see why you are running in to the issue.

The error does not happy on other platform hence the WINDOWS in the title , as I couldn't create the same issue under Ubuntu.

The error went away with a clean build, or ensure a total clear cache (as if existing cache is there, it does tend to appear once or twice, but then goes away) .

So fire away, I am going to set up a portable Grav and PHP in my github, where you can just download a run from a directory. (in progress)

First test is to ensure it runs, then 2nd test is to copy your existing user directory across.

I am not the greatest github user, so bare with me whilst a get this setup and test a releasable version. This version wont interfere with your running stack, as it will be self contained,

@TheDuffman85
Copy link

TheDuffman85 commented Sep 6, 2022

I can confirm that this issue still exists on windows with Grav 1.7.35, Admin 1.10.35 and PHP 8.1.10. All cache was cleared.

@TheDuffman85
Copy link

Still not working with Grav 1.7.36, Admin 1.10.36. Older version of Grav and Admin do work properly. So I don't think it is okay to say it's only a bug in PHP on windows. This bug was clearly introduced by a Grav update.

@ricardo118
Copy link
Contributor

The issue is on this commit getgrav/grav@6fa96ca

@Toutenkit
Copy link

For those who use Windows local
Can you do a test to see if the problem persists

  1. Do not clear the cache
  2. Disable the plugin option : "Flex Objects >Pages (Admin)" /admin/plugins/flex-objects
  • Do a test
  1. Disable the plugin : "Flex Objects" /admin/plugins/flex-objects
  • Do a test
  1. Empty the cache
  • Do a test

@CunoVoll
Copy link

I just made your tests and you seem to be on the right track. Already after disabling the plugin option, there is no more file_get_contents() permission error message. Although the message «Fetch Failed NetworkError» still appears, even when I deactivated the Flex-Objects-Plugin, everything works as usual like before. Thank you for your solution.

@mdestafadilah
Copy link

disable "Flex-ojects" its' work.

@mdestafadilah
Copy link

The issue is on this commit getgrav/grav@6fa96ca

We must waiting for update minor fixed?

@Toutenkit
Copy link

Still those on Windows with the "Flex Objects" plugin.
Is it faster to load the pages in the backoffice when the plugin is disabled? /admin/pages
From my side :

  • Plugin actif : 16 - 20s
  • Plugin désactivé : 2s

Issue
trilbymedia/grav-plugin-flex-objects#166

@CunoVoll
Copy link

I also notice a clear difference, but not that big. For quite some time now, I generally find that the loading speed within the admin has become very very slow compared to how it was before.

@ricardo118
Copy link
Contributor

disabling flex objects isnt an option for many people and you lose a lot of features

@CunoVoll
Copy link

CunoVoll commented Sep 12, 2022

This is hopefully only a temporary solution until the real error is found. But I think this solution proves that the culprit is not the PHP version. By the way, I got this annoying permission-error message even with the latest PHP version 8.1.10.

@Toutenkit
Copy link

@ricardo118 : disabling flex objects isnt an option for many people and you lose a lot of features

It is when the site is in development on windows, in production Grav works very well with Flex Objects


This is hopefully only a temporary solution until the real error is found.

👍

@ricardo118
Copy link
Contributor

the error has already been found on the commit, its a basically, windows doesnt allow to access the file (to read its contents) while teh file is locked. If you comment the lines of the commit i posted above, it will fix the issue, however it may cause an issue where if many saves at once, it doesnt have the proper latest changes non cached

@ricardo118
Copy link
Contributor

@ricardo118 : disabling flex objects isnt an option for many people and you lose a lot of features

It is when the site is in development on windows, in production Grav works very well with Flex Objects

This is hopefully only a temporary solution until the real error is found.

👍

i mean is theres lots of people developing and using flex objects in development, its easier to comment those lines since ur not gonna get mass saves in local dev

@stefanrybacki
Copy link

I just upgraded to PHP 8.1.10 and the error still persists. So this is definetely not fixed.

@rhukster
Copy link
Member

rhukster commented Oct 4, 2022

I've committed a temp fix in Grav develop branch that skips this code on windows:

getgrav/grav@3a00ca0

Please test.

@mdestafadilah
Copy link

I've committed a temp fix in Grav develop branch that skips this code on windows:

getgrav/grav@3a00ca0

Please test.

Failed to create copy: Validasi gagal:
Input tidak valid di "Template Halaman"

@TheDuffman85
Copy link

I've committed a temp fix in Grav develop branch that skips this code on windows:

getgrav/grav@3a00ca0

Please test.

Can confirm that release 1.7.37 solved the issue unter Windows. But strangely the index.php was missing after update and needed to be restored manually.

@yankl
Copy link
Contributor

yankl commented Oct 6, 2022

I've committed a temp fix in Grav develop branch that skips this code on windows:
getgrav/grav@3a00ca0
Please test.

Can confirm that release 1.7.37 solved the issue unter Windows. But strangely the index.php was missing after update and needed to be restored manually.

I had the same issue with the missing index.php on my local Windows machine! But I had it last time I updated as well (v1.7.36). For some reason, didn't think to open an issue then.

@nvandelden
Copy link

I've committed a temp fix in Grav develop branch that skips this code on windows:

getgrav/grav@3a00ca0

Please test.

I can confirm it solved the issue.

@CunoVoll
Copy link

CunoVoll commented Oct 7, 2022

I've committed a temp fix in Grav develop branch that skips this code on windows:

getgrav/grav@3a00ca0

Please test.

I tested it today and everything works fine again. Many Thanks.

@mdestafadilah
Copy link

I've committed a temp fix in Grav develop branch that skips this code on windows:
getgrav/grav@3a00ca0
Please test.

I tested it today and everything works fine again. Many Thanks.

really? fresh install or update? i'm not luck. now, can't save the page file of .md

@CunoVoll
Copy link

CunoVoll commented Oct 12, 2022

I tested it today and everything works fine again. Many Thanks.

really? fresh install or update? i'm not luck. now, can't save the page file of .md

I update Grav to v1.7.37.1 and it worked. On somer older installations update was only possible with PHP 7.4 or even 7.3. To change the PHP-Version is quite easy since I switched from XAMPP to Laragon.

@spamhater-grav
Copy link
Author

This can be finally closed, as in addition Andy has added a patch from mdestafadilah in to the build and no one has had issue since . This can finally be closed and gone to bed. Thanks for all the input. !

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