Jump to content

'failed to open stream: Permission denied' warning


Recommended Posts


755 for folders and 644 for files (with FileZilla, for example, you can easily do it - recursively).

But you can/could lower the permissions for some files like site/config.php, .htaccess, index.php, ready.php, etc., depending on your hosting environment, as long as it works.

See also https://processwire.com/docs/security/file-permissions/

Perhaps you should empty your site/assets/cache/ folder.

You can also look at the results in Google for the following request:
site:processwire.com/talk 'failed to open stream: Permission denied' warning

Edit: verify the site/assets/ folder permissions as well as the permissions of all its (sub-)folders and ("sub-")files.
(Perhaps, also try refreshing the modules cache.)

  • Like 3
Link to comment
Share on other sites

Hey Christophe, thanks for the reply.

I emptied all the folders inside site/assets/cache/  folder.

Now the server is showing this error instead-

Error: Exception: Unable to create directory /home/admin/web/mywebserver.example.com/public_html/site/templates/ (in /home/admin/web/mywebserver.example.com/public_html/wire/core/FileCompiler.php line 228)

I even tried changing the ownership of these files in SSH using the 'chown' command. nothing worked,

Link to comment
Share on other sites

Okay, I solved it. File ownership was the problem.

executed this in a php file-

echo get_current_user();  //Acer
echo exec('whoami');   //admin

Got different outputs for both.

The script is run as admin; I thought the folder owner should be admin too.

So I went to the online SSH (I'm using google cloud as server), used `sudo su` to change user to root and then ran this command-

chown -R Acer /home/admin/web/mywebserver.example.com/public_html/site
chown -R admin /home/admin/web/mywebserver.example.com/public_html/site

ls -l /home/admin/web/mywebserver.example.com/public_html/site

The output was-

total 16
drwxrwxr-x 7 admin Acer 4096 Mar  1 18:35 assets
-rw-r--r-- 1 admin Acer 2616 Mar  1 21:33 config.php
drwxr-xr-x 7 admin Acer 4096 Mar  1 18:17 modules
drwxrwxr-x 7 admin Acer 4096 Mar  1 18:18 templates

And the warnings were gone.

I still don't completely comprehend all the technical details at play here, so I should be careful.

I would like to know if I have made any mistakes or have left some loopholes in these settings that might be problematic later?


P.S.- I'm loving PW and especially the community. You guys are awesome!

Link to comment
Share on other sites



If I have the choice I prefer to use a program like FileZilla for (S)FTP.
I still have to try FreeFileSync (that I'm using for computer backups) for (S)FTP synchronization, but it seems easier to set up (and use) for Windows or Mac OS X than for Linux.

You could perhaps at least lower your folders' permissions to 755 (instead of 775, like it's the case for assets/ and templates/).

Perhaps quickly check your (sub-)folders' and ("sub-")files' permissions (even outside site/).

Have a nice weekend!

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...