0

ホスティング会社と仮想 Linux ホスティングを共有していますが、CPANEL のみを使用することは知っていますが、CLI を使用することは知りません。ホストによる PHP 5.2 から PHP 5.3.2 への最近の移行では、ディレクトリで file_put_contents を使用しているときに、ファイルへの書き込みに対してパーミッション拒否エラーがスローされます。だから私は自分の能力でいくつかのデバッグを試みることを考えました

// Assume my file is 
// here /home/myhostaccount/public_html/mytest where mytest is 755
// Assume migrated.log exists in the above directory and migrated.log is 644

$file1 = "migrated.log" // this is migrated file which is denied write
$file2 = "dummytest.log"    // this file I created for debug, it allows write

writeme($file1,"This file existed before in 5.2 and was writeable, but fails to do a write after migration  "); 
  // permission denied error failed to write BUT works if file forced to 646

writeme($file2,"This is created file by Me for Debugging ");    
  // works - writes just for the default 644

function writeme($file ,$data) {
  $result = file_put_contents($file , $data, LOCK_EX);
  if ($result === false) {
    echo "failed to write to $file";  echo "<br/>";
   }else{
    echo "successfully written $result bytes to $file <br/>";
  } 
 }

次に、ファイル所有者を確認しようと思ったので、

 print_r(posix_getpwuid(fileowner($file1)));
 echo "<br/><br/>";
 print_r(posix_getpwuid(fileowner($file2)));

次のように出力されます

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 )

まず第一に、私はこの完全な出力を理解するのに適した管理者ではありません。

私の質問は

a) 同じディレクトリにあるファイルが別の所有者として実行される理由 1) myhostaccount 2) nobody

b) myhostaccount が失敗しているのに 646 でしか書き込みできないのに、誰も 644 で書き込みを成功できない理由

c) どこに問題がありますか? 私の側で....または...ホスティング側で

d) それが私の側で解決しなければならない場合、私は何をすべきか、または彼らと一緒にいる場合、私は彼らに何をするように頼むべきですか

親切に助けてください。

よろしく

4

1 に答える 1

0

これの唯一の理由は、ファイルの 1 つが既に存在し、もう 1 つがPHP によって作成されたことです。

于 2013-05-19T15:18:35.950 に答える