php - why two different owner for posix_getpwuid(fileowner($file)) within same directory, what does it mean? -
i have shared virtual linux hosting hosting company , know use cpanel , dont know use cli. recent migration php 5.2 php 5.3.2 host throwing permission denied error writing file while using file_put_contents in directory. thought try few debug things in capacity
// assume file // here /home/myhostaccount/public_html/mytest mytest 755 // assume migrated.log exists in above directory , migrated.log 644 $file1 = "migrated.log" // migrated file denied write $file2 = "dummytest.log" // file created debug, allows write writeme($file1,"this file existed before in 5.2 , writeable, fails write after migration "); // permission denied error failed write works if file forced 646 writeme($file2,"this created file me debugging "); // works - writes default 644 function writeme($file ,$data) { $result = file_put_contents($file , $data, lock_ex); if ($result === false) { echo "failed write $file"; echo "<br/>"; }else{ echo "successfully written $result bytes $file <br/>"; } }
next thought check fileowner , hence
print_r(posix_getpwuid(fileowner($file1))); echo "<br/><br/>"; print_r(posix_getpwuid(fileowner($file2)));
i output as
array ( [name] => myhostaccount [passwd] => x [uid] => 1083 [gid] => 1083 [gecos] => [dir] => /home/myhostaccount [shell] => /bin/bash ) array ( [name] => nobody [passwd] => x [uid] => 99 [gid] => 99 [gecos] => nobody [dir] => / [shell] => /sbin/nologin )
in first place not admin understand full output, surprised why 2 different things
my question are
a) why file in same directory run different owner 1) myhostaccount 2) nobody
b) why nobody able successful write 644 while myhostaccount failing able write 646
c) problem ? on side ....or... on hosting side
d) if has fix on side should or if them should ask them do
kindly help.
regards
the only reason can be, 1 of files had existed , other 1 created php
Comments
Post a Comment