• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

Simple fopen question

<?
$fd = fopen("log.txt","a") or exit("Unable to open file!");
fwrite($fd, "hi");
?>


i keep getting the exit error and log.txt is blank.

im running php 5 on a centOS 5 box.

any suggestions?

thanks.
0
Neil2526
Asked:
Neil2526
  • 2
  • 2
2 Solutions
 
MasonWolfCommented:
Sounds like your script doesn't have necessary permissions to create a new file. Try changing permissions on the folder to 777. See if that does anything.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please change the error_reporting variable to "see" what error you actually get?
0
 
Neil2526Author Commented:
tried that Mason, no luck. Thanks for the response.

angel, i am unclear as to what you are asking. please elaborate.

thanks.
0
 
MasonWolfCommented:
error_reporting(E_ALL);
0
 
Neil2526Author Commented:
not sure what happened, but now it is working.

thanks to you both.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now