harshpandya Posted September 2, 2008 Share Posted September 2, 2008 Hi All, This is my code: chmod("test.xml",0666);Now problem is it does not give rw- rw- rw permission to my file. Note: test.xml is actually linking to another file called test2.xml. I thought if i change permission on test.xml, it should change the permission of test2.xml file also. But it does not.. So how do i change permission of test2.xml. test.xml links to test2.xml and test.xml has lrwx-rwx-rwx permissionPlease help, Thanks, Link to comment Share on other sites More sharing options...
Jesdisciple Posted September 2, 2008 Share Posted September 2, 2008 Err... Does this work? chmod("test2.xml",0666); This is an operating system setting, and the operating system probably regards a file and a link to a file as separate entities. I ran into this when I was trying to set up a test server on my Linux installation. If I linked to a write-protected folder from a folder in my home directory, I couldn't use it; if I linked to the folder in my home directory from the write-protected folder, I could use it. Link to comment Share on other sites More sharing options...
harshpandya Posted September 2, 2008 Author Share Posted September 2, 2008 The Problem is - I created one temp.xml file in the same directory above and tried chmod("temp.xml",0666); and it worked perfectly fine. and change the permission. So why temp.xml file would work and test.xml will not work. Please help Thanks, Link to comment Share on other sites More sharing options...
justsomeguy Posted September 2, 2008 Share Posted September 2, 2008 What's different about test.xml and temp.xml? Link to comment Share on other sites More sharing options...
harshpandya Posted September 3, 2008 Author Share Posted September 3, 2008 test.xml links to test2.xml and test.xml has lrwx-rwx-rwx permissionwhile i just created temp.xml which has simple rw-r - r permission and does not link to anythingthats the only difference i can notice. One more thing - if i do ssh in the system and then do chmod from CMD prompt it changes the permission for test.xml but by using PHP chmod it does not change permission.while for temp.xml both the options work fine. please help Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted September 3, 2008 Share Posted September 3, 2008 You can have PHP run the console command if you want. I'm not sure why the PHP version of chmod would function differently then the shell version, I thought one ran the other. $chmod_output = `chmod test.xml 0666`; Link to comment Share on other sites More sharing options...
harshpandya Posted September 3, 2008 Author Share Posted September 3, 2008 I found the problem - test.xml is actually owed by root user only while i was trying to access the file Local user, Thanks for the Help, Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.