Start a conversation

Fixing files and folders permissions of your hosting service

Some users can face permissions problems with the hosting account service.
After you published aplications and you get messages like "500 Internal Server Error" or when trying to creating the connection on scriptcase deploy environment you get an error like this "failed to open stream: Permission denied in..."

The first thing that some people say is to give 0777 permission. The first "7" is the total permission for the owner, the second one is for the group and the third "7" is for everyone. Here is the trick, for hosts company, a permission 0777 is a security issue for php files. "Everyone" can't have total permission. So you cant an internal server error.

The correct permissions are:

Folders: 0755
Files: 0644

So, how to fix?
Step-by-step:

1. Open a shell (or putty on windows) and log in into your SSH account;
(if you don't know how do this, just follow this tutorial.

2. Execute the command to solve these problems at your public_html(www) folder:

find /home/$(whoami)/public_html/ -type d -exec chmod 755 {} \; && find /home/$(whoami)/public_html/ -type f -exec chmod 644 {} \; && find /home/$(whoami)/public_html/ -name wkhtmltopdf* -exec chmod 755 {} \; && find /home/$(whoami)/public_html/ -name phantomjs* -exec chmod 755 {} \; && find /home/$(whoami)/public_html/ -name zend* -exec chmod 755 {} \; && find /home/$(whoami)/public_html/ -name 7za* -exec chmod 755 {} \; && find /home/$(whoami)/public_html/ -name qpdf-linux-amd64* -exec chmod 755 {} \;

Example: 

If you need to change permissions in another directory like a addon domain directory, just replace every public_html in this command by the directory name you want.

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Victor Gomes

  2. Posted
  3. Updated

Comments