I’m stuck on this one. Any help much appreciated. How do I correctly set permissions so that I can ?flush via a browser AND also run tests. For the following files:
If I set the owner to _www then I can ?flush in the browser, but I can’t run tests. I get the CLI error:
PHP Warning: file_put_contents(/public/assets/.htaccess): failed to open stream: Permission denied in vendor/league/flysystem/src/Adapter/Local.php on line 135
If I then set the owner to my use, I can run tests but I can’t ?flush. I get the browser error:
# [WARNING] CHMOD(): OPERATION NOT PERMITTED
Line **356** in **/vendor/league/flysystem/src/Adapter/Local.php**
* **chmod(/public/assets/.htaccess, 436)** Local.php:356
What do I need to do to allow me to ?flush and also be able to run my tests?
The secret here is to run the CLI commands as the same user the web server process uses, that keeps all the file ownership and permissions nice and simple. It’s not just the htaccess stuff which is affected, running as different users, you’re likely to end up with different sets of cached files too which can cause all manner of confusion!
I did ?flush via the browser, but since the tests were running as a different user,
maybe they had a seperate class Manifest that was out of date? Not sure if the cli cache can be flushed separately.
Quite possibly. You can still flush from the command line in the same way, but as I say, it’s much simpler to just use the same user for all operations, everything stays much cleaner.