Simple fopen question

Posted on 2007-09-30
Last Modified: 2008-01-09
$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?

Question by:Neil2526
    LVL 13

    Accepted Solution

    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.
    LVL 142

    Assisted Solution

    by:Guy Hengel [angelIII / a3]
    please change the error_reporting variable to "see" what error you actually get?

    Author Comment

    tried that Mason, no luck. Thanks for the response.

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

    LVL 13

    Expert Comment


    Author Comment

    not sure what happened, but now it is working.

    thanks to you both.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    This is a general how to create your own custom plugin system for your PHP application that you designed (or wish to extend a third party program to have plugin functionality that doesn't have it yet).  This is not how to make plugins for existing s…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to dynamically set the form action using jQuery.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now