1

My site is on a shared hosting. I've been using FTP and PHP File Manager to upload and delete files. Recently I've found a file I couldn't delete due to permissions, neither in PHPFM nor in FTP. So I've used DirectAdmin (the only option for my plan) to reset all permissions. Then I set all permissions for all files in public_html and subfolders to 777 recursively. I know only that it allows me to do more than any other permission variant.

Now the site is running in a static way, I can open PHP File Manager and it has no permission to upload files. I can upload files in DirectAdmin, however, but that feels unsafe. PHP File Manager reads: 'I/O error'. The directories look like this:

enter image description here

What do 1422 and 1420 mean? What can I do to upload files again? Thank you for the help.

10
  • 1
    1422 is your linux user_id and 1420 group_id. Commented Oct 28, 2015 at 21:18
  • 1
    setting 777 and using a file manager script in the server is quite a serious risk, especially if a folder permission is set as 777... where is your php file manager located? is it able to access that folder with the files to add/modify/delete from where it is residing? Commented Oct 28, 2015 at 21:20
  • 1
    1422 and 1420 are the owner and group ids, most likely they are not the root user. If you set everything to 777 (including folders) usually those ids do not matter... It could also be a setting on php.ini to disallow upload input, your host may have changed it... Commented Oct 28, 2015 at 21:29
  • 1
    You are user 1422, belonging to group 1420. Now you have full permissions. Commented Oct 28, 2015 at 21:29
  • 1
    The safe thing is to set the files to 644 and folders 755. This gives you the only right to change files and write into directories, but leaves everyone else permission to read. Apache is often run as another user, so you must giv it permission to read the files and directories. Commented Oct 28, 2015 at 21:32

1 Answer 1

1

1422 is the user_id the file belongs to and 1420 the group_id it belongs to.

Linux has a permission system, where you can give special permissions to the owner, your group and everyone else.

Permission 777 means everybody can read/write/execute, your group (1420) can read/write/execute and you (user 1422) can read/write/execute the file.

Permissions: 
1 is execute file or open directory 
2 is write 
4 is read

Read/write permission is 2+4=6, read/execute (or open a directory) is 1+4=5

The three numbers represents [owner][group][everybody], so setting a file to 644 means user can read/write and everybody else just read a file.

Edit: The safe thing is to set all files to 644 and directories to 755. Private files should be 600 and executable files 755 (PHP files are NOT executable).

Apache is run as user apache or httpd, which is another user, therefore you must give "everybody" permission to read your PHP files and directories.

Edit2: If you need PHP to upload files, it is really done as user apache/httpd. Therefore you need to give full privileges to "everybody" to open directories and read/write 777. The file permissions should be 666.

Sign up to request clarification or add additional context in comments.

7 Comments

Thank you!! I've set files to 644, including the php file manager .php file, and folders to 755, and I still see "I/O error" when I try to upload files. php.ini is unaccessible for me. DirectAdmin works. Perhaps the only thing left is to wait for support answer?..
Can you get an explanation of the "I/O error", error writing, error logging in...
It's an error writing. The filemanager writes it that way when it can't write to a file.
How about using another ftp program, like Chrome or Firefox (ftp://username:[email protected]/path)
The problem is that I need my own PHP scripts to write files there... Ok! I see it's something I should contact the support for. Thanks to everybody :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.