Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    DSC
    DSC is offline
    Junior Member
    Join Date
    Feb 2003
    Posts
    4
    Member #
    691
    Well, I'm totally new to php and am testing some examples from my book 'PHP and MySQL Web Development' but they don't work. Well, the code appears to work but not with my server.

    Just attempting to open and write to a flat file for now...
    Here's my error. They say in the book that this is a common error, but don't really give newbie info on how to go about solving it
    Warning: fopen("/home/*******/public_html/*********/chapter02/orders.txt", "a") - Permission denied in /home/*******/public_html/*********/chapter02/processorder.php on line 54

    (*'s are edited directories)

    I created the directory and the file but I dono how to give access.
    So, I'm lost really don't know what to do.

    Hopefully this is the right section to post in

    Thanks in advance!
    Dave-

  2.  

  3. #2
    Guest
    Sorry but I couldn't find any threads that seemed to be related to yours. I'm sure a human will reply soon to help out.

  4. #3
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You can guarantee access to it by chmod'ing the data file 777 (don't know the other ones for just read access to everybody).
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  5. #4
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    Most likely your webserver is running under the user 'nobody'. I'm also guessing from the format of your path that you are running cpanel ( irrelavent here ).

    Ask your webhost to change the filegroupe to nobody and set the permissions to allow group writes.

    chgrp nobody orders.txt
    chmod g+w orders.txt
    There and Back Again :Ogre:

  6. #5
    DSC
    DSC is offline
    Junior Member
    Join Date
    Feb 2003
    Posts
    4
    Member #
    691
    Thanks for the help guys, I got it to work.
    Wondering if there is any security risks tho.
    Its writing to a file outside of the web directory
    public_html/../filename.txt
    So I figured since nobody can get to it (right?), i'd just set that files permissions to 777.
    Is this safe? I'll be writing to a mysql database by the end of the week so I'll scrap that script anyway, just curious.

    Thanks,
    Dave-

  7. #6
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Databases tend to be more secure than flat files. Just make sure that filename.txt isn't in your public_html/www/any other public directory.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:32 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com