hi i am following this etutorial and the code is not working and dont get why. There are two bits of code:

>
<body>
<?
$sonnet76 = <<<HERE
Sonnet # 76, William Shakespeare

Why is my verse so barren of new bride,
And keep invention in a noted weed,
HERE;

$fp = fopen("sonnet76.txt", "w");
fputs($fp, $sonnet76);
fclose($fp);

?>

When i click this file i get permision denied and it wont write even thou i have allowed all the permisions.

<body>
<?
$fp = fopen("saveSonnet.php", "r");

//first line is title
$line = fgets($fp);
print "<center><h1>$line</h1></center>\n";

print "<center>\n";
//print rest of sonnet
while (!feof($fp)){
	$line = fgets($fp);
	print "$line <br>\n";
}

print "</center>\n";

fclose($fp);
?>

This code returns the other except it does not show the code it is all hidden. Thanks you could give me any information about what is happening and if i am doing it wrong.

Recommended Answers

All 3 Replies

First code works just fine.
You'll have to chmod 777 the folder that the script is running in.

First code works just fine.
You'll have to chmod 777 the folder that the script is running in.

Yes the file permissions are 777 is that what you mean?

Yes the file permissions are 777 is that what you mean?

Its fixed i was changing indivudual files to 777 rather than the whole folder whoop shame its took two days to figure that out ha x

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.