Answer the question
In order to leave comments, you need to log in
How to change folder permissions?
Using the function mkdir( $dir, 0777 );
, I created folders on my hosting. And now I can’t delete them, rename them, change the rights, not only through filezilla, but even through DirectAdmin in the hosting control panel. The problem is that when creating, the rights to the folders were assigned not 777, but 755. And in the owner field it says "apache", and on the other folders my hosting login.
What to do in this case?
Answer the question
In order to leave comments, you need to log in
This happens if a non-zero umask is set on the server .
In order to create folders with the rights you need in this case, you can use the following code:
$old_umask = umask(0);
mkdir($dir, 0777);
umask($old_umask);
chown($dir, "your_user"); // Поменять владельца
chmod($dir, 0777); // Присвоить файлу другие права
Actually, change the owner to root (most likely) or to your user in order to gain access via FTP.
Through SSH, this is done something like this:
where user is the name of the user to which you are changing the owner, and folder is the folder for which you are changing the owner.
And then you will get full rights to manage the rights of the folder.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question