テキストドキュメントに書き込み/ログを記録する基本的なphpスクリプトがあります
<?php
$filename = 'php_log.log';
$somecontent = 'writing with fwrite!'.PHP_EOL;
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
error_log('logging with error_log!'.PHP_EOL,3,'php_log.log');
?>
CLI から、php test.php
php_log.log を実行して確認すると、両方の書き込みが表示されます。しかし、試してみるとphp test.php &
、php_log.logに何も書き込まれません
私が知らないphp設定はありますか?ありがとう!