I am trying to create a log file for my website. For this, I use the following code to try to open the file. Now the file does not exist yet, but the documentation states that adding the “+” flag ensures that the file is created if it does not exist.
$file = fopen($_SERVER['DOCUMENT_ROOT']."/logs/mylogfile.txt", "a+");
The above code gives me the following error ...
Warning: fopen(E:/wamp/www/logs/mylogfile.txt) [function.fopen]: failed to open stream: No such file or directory
What am I doing wrong? Please excuse me if this is a stupid question, I am very new to PHP.
source share