I’m really curious as to how the permission changed ?
Did you possibly use an upload script that set the permissions ?
Admin asked a staff to fix it.
Sorry, I thought you were asking about how the permissions were fixed
I think Lovebug was pondering on how the problem occoured in the first place, not how it was fixed.
At a guess, either a script broke the permissions, or OP accidentally uploaded files with a broken permission set.
More likely the script.
I was under the impression that it was no longer possible to cause these issues. Then again, looking at the modification times of the directories, it looks like this happened a while ago.
I just created a new domain with a test directory and trying to set the permissions with filezilla to anything that would lock out access causes the permissions to reset to 7xx
I haven’t tried it with php yet
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
Hello,
I opened a post a few days ago about a problem accesing to some files inside my hosting. After further investigations the admin of the server found that the problem was with the permissions of the folders inside the hosting, which for some reason are with some extrange configuration, and they fixed it.
The original post is: https://forum.infinityfree.com/t/missing-files-in-file-manager/107126/25
We thought that the original problem was in our web app which creates the folders from php and assign nondefault permissions to the folder. We fixed it in our code, but we forgot one part of the code and we have the same problem again with some folders.
It would be possible to repair the whole htdocs subfolder to assign default permissions (755) again ??
Thank you so much and our apologies for this.
Can you please tell us how you were able to cause these bad permissions in the first place? Then we can try to make it so that it’s no longer possible to make this mistake again.
I created subfolders into my htdocs folder structure from our web app using mkdir function from php.
I created subfolders with 755 value for permissions. Typing that explicit value in the function´s parameters. We are not php experts, we found that way and it seemed to work until we need to made a backup of the files.
Maybe the problem is that the php process is running under an account that differs from the one that the system uses to browser the files ? we don´t know a lot about this really.
could you post the php source code ?
just the function that creates directories and sets the permissions as it would be helpful to see what is going on and create a solution
thanks
Nothing special, just the php mkdir function, somethink like that:
mkdir("../images/".$_POST["Id_Folder"]."/", 755)
I think the reason you have this issue is this part from the official PHP documentation:
The permissions are 0777 by default, which means the widest possible access. For more information on permissions, read the details on the chmod() page.
Note that you probably want to specify the
permissions
as an octal number, which means it should have a leading zero. Thepermissions
is also modified by the current umask, which you can change using umask().
This suggests the correct permissions should be 0755
, not 775
.
Still, it’s a problem on our end that this is a problem to begin with. I’ll ask staff to reset your directory permissions and look for a way to make sure that this can’t happen again.
Hello, we made a correction to our code after this problem happened for first time. But we miss some parts that stills with the wrong format, so some of the new folders created since are with wrong permissions.
We think we have corrected it in all our code now.
Thank you so much.
I think it is the time to create documentation about the DOs
and DONTs
in developing PHP applications on Infinityfree web hosting platform. I do not know how many users are actually reading the “Knowledge Base” section of this forum, but it’s better to enlist the common mistakes in one place. I know it is the developer’s responsibility to ensure that the PHP code is safe but yeah.
The permissions of your account should be fixed now!
Strong disagree with you there. Nobody is going to look for such documentation ahead of time, and if they do see it, they might not fully understand it or be able to successfully apply it to their code. The only benefit I see is that it would let you pull the “if you had read the documentation…” card when issues happen, which is not helpful.
The system should be fool proof to begin with. And for particular errors or issues, we can or have documentation covering the specific issue.