Working in Putty but not in Browser!

Hello…
Below i have listed some codes. It is working well in putty but not in browser(IE, google chrome).

<?php

//OPENING the input FILE
//**********************
$fp = @fopen(“sample.txt”,‘w’) or die(“Could not open sample.txt file”);

fwrite($fp,"Testing
");
fclose($fp);

?>

<HTML>

File open testing
</HTML>

Anybody will help me to fix this problem?

Thanks in Advance…
Rose

What happens when you try opening it from a browser?

Also, try not to use error suppression when debugging/developing.

Im getting Could not open sample.txt file message.
The new file was not created…

It sounds like a permissions problem. I forget now about the best-practice techniques that relate to file/folder permissions and publicly accessible web pages.

oh… Plz help me to solve this prob…

Check your web-server logs for errors.
Check directories permissions and change it with chmod, chown command if necessar

I changed the file permission and now its working…
Thanks alot for ur help… :slight_smile: