たくさんのlinuixサーバーとWindowsサーバーがあります。
Windowsデスクトップでは、すべての共有を確認できます。
PHPを使用して、UNCパスを使用してWindows共有上のディレクトリにファイルを書き込もうとしています。
//ServerShare/directory/file.txt
を使用するfwrite
と、ファイルは正常に書き込まれましたが、ファイルがサーバーに存在することはありません。
関数を使用opendir
すると、ディレクトリにアクセスできなくなります。
これは非常に単純なソースです。
$file_name = "\\SERVER2\Share\CPI\data.txt";
if (!$handle = fopen($file_name, 'w')) {
echo "Cannot open file ($file_name)";
exit;
}
// Write $somecontent to our opened file.
$somecontent = "this is a test";
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($file_name)";
fclose($handle);
LinuxボックスがWindowsボックスにファイルを書き込めるようにするには、どのタイプのアクセス許可を設定する必要があるかについて何か考えはありますか?