/    Sign up×
Community /Pin to ProfileBookmark

php wont write but will read text??

WHy wont my text file update?
this says that there is a connect error.. I have tried fwrite().. everything.. it all wont write to the file.. the only thing that works is if i read and echo…

THIS WORKS

[QUOTE]

<?php
$news = file(“file.txt”);
echo $news[0]. “<br>”;
echo $news[1] . “<br>” . $news[2]
?>

[/QUOTE]

But this doesn’t???

[QUOTE]

<?php
$file = fopen(“test.txt”,”w”);
echo fwrite($file,”Hello World. Testing!”);
fclose($file);
?>

[/QUOTE]

Does this mean that my php server doesn’t allow it?? b/ci have a huge forum on my site… [url]www.106clan.org[/url]

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 05.2007 — It's most likely that the file permissions do not allow it. (Remember that your script is probably being run as a user other than your personal login account, so the file will likely need write access by all if you want your script to write to it.)
Copy linkTweet thisAlerts:
@guyjusthereauthorAug 05.2007 — soo... do i have to add that on the top of the script to log in to the server?
Copy linkTweet thisAlerts:
@NogDogAug 05.2007 — No, you probably have to log on to your web host and change the file permissions, either via FTP or your web host's control panel application, or by connecting via telnet and changing permissions via the command line.
×

Success!

Help @guyjusthere spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...