I am learning file handling in php. I have written the following code to create file:
<?php
$fileName = "testFile.txt";
$fileHandle = fopen($fileName,"w") or die ("can't open file");
fclose($fileHandle);
phpinfo();
?>
The problem is I am getting “can’t open file”. I changed the permission of the directory containing this file and all the files in the directory to 777 still the problem persists.
Can somebody please help me in solving this issue?
Thanks
have you tried using an absolute path for the $filename
or you can change dir prior to opening the file
http://nz.php.net/manual/en/function.chdir.php
AMENDED ANSWER, TRY THIS