Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • 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

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

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