0

How to create seperate log file directory for php.

hello i need to store php log files on seperate directory.. how to create separate location to store php log files..

nicholas
asked Oct 19, 2017
1 Answer
0

To write to a log file and make a new one each day, you could use date(""j.n.Y"") as part of the filename

//Something to write to txt log
$log = ""User: "".$_SERVER['REMOTE_ADDR'].' - '.date(""F j, Y, g:i a"").PHP_EOL.
""Attempt: "".($result[0]['success']=='1'?'Success':'Failed').PHP_EOL.
""User: "".$username.PHP_EOL.
""-------------------------"".PHP_EOL;
//Save string to log, use FILE_APPEND to append.
file_putcontents('./log'.date(""j.n.Y"").'.log', $log, FILE_APPEND);"

View More
linuxhelp
answered Jan 14, 2019
Your Answer
||||
x
 
100:0

Related News in How to create seperate log file directory for php.

Related News in How to create seperate log file directory for php.