Changing the Permission of the file

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
ajaymallaya
Forum Newbie
Posts: 4
Joined: Fri Jul 27, 2007 5:22 am

Changing the Permission of the file

Post by ajaymallaya »

Hello,

I need to change the permission, group and owner of a file dynamically using php in a linux platform. Please let me know what is the best solution. Whether to use chmod(), chgrp() functions or the php_exec() and directly give unix commands in it.

Thanks in advance,

Ajay
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Post by dude81 »

chmod and chown are good enough
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Bear in mind that if these functions are to work you *need permission to change the permissions* if that makes sense. i.e. If the files were created by FTP, and PHP/Apache is not running under your own userid then you may struggle.
ajaymallaya
Forum Newbie
Posts: 4
Joined: Fri Jul 27, 2007 5:22 am

Is chmod secure enough????

Post by ajaymallaya »

hi,

Thanks for the reply. My userID is having enough permission to change the permission of the files.

But one questions... Is there any security risk / concrens for using this methods?

Or I will put it in this way, what are the things which we should keep in mind while using these functions/ methods?

Thanks again for you reply,

regards,

Ajay
Post Reply