PDA

View Full Version : file handling in php



yogi4
4th August 2009, 04:25 AM
Hi m doing file handling in php, my script is -

<html>
<head>
<title>
Flat file
</title>
</head>
<body>
<?php
$today=date("Y-m-d");
$fh=fopen("wtf.txt","a");
fwrite($fh,$today);
fclose($fh);
?>
</head>
</html>

but its showing following error on execution

Warning: fopen(wtf.txt) [function.fopen]: failed to open stream: Permission denied in /var/www/html/fha.php on line 10

Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/html/fha.php on line 11

Warning: fclose(): supplied argument is not a valid stream resource in /var/www//html/fha.php on line 12

I hd tried both in fedora & ubuntu m doing all my work as a root user...

Pls help me in dis regard.Thanx in advance