Change folder permission at creation time (run time)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tirtha
Forum Newbie
Posts: 1
Joined: Thu Apr 08, 2004 6:28 am

Change folder permission at creation time (run time)

Post by tirtha »

when am creating a folder in unix system through php it running fine but if i want to create another folder or file in the created folder then it is giving error for "not permission".please help me out of this prob
regards
tirthankar
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Post by TheBentinel.com »

There may be a better way to do it, but you could probably do a chmod on the new folder once you create it:

<?php
passthru("chmod 777 newfolder");
?>

777 is wide open, anybody can do anything. You probably don't want it quite that wide, but if you start there you can see if it works. Then you can dial it back to something more secure. (755?)

Google "unix file permissions chmod" to learn how to set them up.
Post Reply