benphp Posted May 6, 2008 Share Posted May 6, 2008 I can use this code to write to an EXISTING file, but when I try to use it to CREATE a file, it fails - or rather, it doesn't do anything - not even throwing an error. What am I doing wrong? <?php $path = ""; $filename = "myfile.txt"; $fp = fopen($path.$filename, 'w') or die("Sorry charlie"); flock($fp, LOCK_EX); fwrite($fp, "I like almonds"); flock($fp, LOCK_UN); fclose($fp); ?> Thanks! Quote Link to comment Share on other sites More sharing options...
benphp Posted May 6, 2008 Author Share Posted May 6, 2008 Nevermind - it doesn't like flock. Why would flock screw it up? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.