500 error in browser. [InvalidArgumentException] on server

So I am getting 500. Tried to fix it by running that bash permission fix script but did not help. On production server, when I execute as root in console:

bin/grav clear-cache

I am getting:

  A stream must either be a resource or a string.

Live log from nginx (/var/log/nginx/xxxxxxxxx.com.error.log.1) when I reload address in web browser:

#0 /home/pia/www/xxxxxxxxx.com/system/src/Grav/Common/Service/LoggerServi ceProvider.php(29): Monolog\Handler\StreamHandler->__construct(false, 100)
#1 /home/pia/www/xxxxxxxxx.com/vendor/pimple/pimple/src/Pimple/Container. php(113): Grav\Common\Service\LoggerServiceProvider->Grav\Common\Service\{closur e}(Object(Grav\Common\Grav))
#2 /home/pia/www/xxxxxxxxx.com/system/src/Grav/Common/Plugins.php(184): Pimple\Container->offsetGet('log')
#3 /home/pia/www/xxxxxxxxx.com/system/src/Grav/Common/Plugins.php(37): Grav\Common\Plugins->loadPlugin('error')
#4 /home/pia/www/xxxxxxxxx.com/system/src/Grav/Common/Grav.php(436): Grav\Common\Plugins->__construct(Object(Grav\Common\Grav)) 
#5 /home/pia/www/xxxxxxxxx.com/vendor/pimple/pimple/src/Pimple/Container. php(113): Grav\Common\Grav-" while reading response header from upstream, client:, server: xxxxxxxxx.com, reque$

What’s happening?

That’s strange. Did you get this error just after moving to a different server, or you got this also locally for example?

@flaviocopes - I did not want to spend more than 30min investigating it so I simply copied another Grav website, removed existing pages and adjusted config. This way was the fastest I could “fix” it.

I noticed that so far, the biggest bottleneck installing Grav are permissions and many times people here were struggling with it (including myself).

This appened to me just now, cloning a Grav repository. I fixed it just adding the logs and images folder, so, Grav should create those folders when they are missing.

Permissions if set incorrectly are a pain in any kind of project. I’ve seen over time many many hosting providers messing up permissions for wordpress and joomla for example (mentioning 2 projects I’ve experience in, and which I supported for years) and some (not all) hosting providers got them right after quite a bit of time of being asked again and again for issues with those 2 popular CMS.

Most of the times on good hosting providers permissions just work, but misconfigurations can still happen (and will happen when you manage your own server).

Basically, with any CMS, the site must be uploaded (or created) with the same user & group that runs the Web Server.

In this way, the web server is the owner of the files and folders and can change them.