I'm trying to phrase access log files on my Nginx server.
For phrasing the file, I simply rename the original access log file and create a new access log file immediately so I won't miss anything.
But after replacing the file, Nginx won't log anything onto that file but works until I replace the file.
Nginx start logging again to the replaced file after I restart Nginx.
I can not see what I'm doing wrong, any help?
First bit of the PHP code
if(rename("access.log", $tempname)){ // I'm renaming the access log file
$fp = fopen("access.log","wb");
if( $fp == false ){
}else{
fwrite($fp,$content); // I'm creating a new access log file
fclose($fp);
}
// I'm phrasing the renamed file here
}