How can I change the chmod to 0777 through PhP for a folder with subfolders and all it's content!? Or if I set the chmod for the folder with the subfolders all the subfolders will have 0777 permission as well? Thanks :)

Recommended Answers

All 8 Replies

Have you considered the security implications of giving the world and its dog complete and unfettered access to your system?

If you have a PHP manual and you look up chmod, then there it is. As mentioned however; setting it to 777 may not be the greatest idea.

I need to write many files in my script, so chmod 0777 is kind of necessary and also upload lots of images in the folder. I didn't know of any negative impact of this exactly.

I need to write many files in my script, so chmod 0777 is kind of necessary and also upload lots of images in the folder. I didn't know of any negative impact of this exactly.

PHP itself has access to everything.
I don't understand why you want the whole world scribbling in your files!
What EXACTLY is it that are you trying to do? Surely there is a better way!

my scripts writes and creates files in a folder and also uploads image files, so for writing and uploading i think i have to give permission 0777, don't I!?

my scripts writes and creates files in a folder and also uploads image files, so for writing and uploading i think i have to give permission 0777, don't I!?

No, that's what logins and user accounts are for.
If you do 777, you will become a hacker/spammers paradise. If it gets bad enough, you might even hear from the FBI.
Good luck!

Well yeah.. I didn't say I don't have security, I always regulate the traffic and access through .htaccess and cookies. But still, I can't write files or unlink them unless I'm making my folder 0777. The only way I could realize this so far was through ftp_chmod(), but this is not so convenient for a customer to input his ftp account data so he could rewrite his folder's access in ftp, this could be indeed considered a scam:P so, is there a way to chmod() a folder, because I'm out of luck so far!:(

.htacess? Now there's another thing that has a real down-side.
I only do database driven dynamic sites . It makes it a lot easier to securely deal with users. .htacess is almost a thing of the past! I avoid it like the plague.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.