Can't get chmod to work

Discussion in 'PHP' started by egdcltd, Jul 8, 2010.

  1. #1
    I have a small PHP file which I use to generate a txt sitemap. Currently, I'm manually chmoding the sitemap.txt to 666 permissions, running the script, then chmodding back to 664.

    I want to automate this to run using a cron job, but it will only work by leaving the file at 666 permissions, which is a bit of a security risk. I tried using chmod("sitemap.txt", 0666); within the script itself, but this generates the following error:

    Warning: chmod() [function.chmod]: Operation not permitted

    I think this may be related to ownership, but I'm sure there's some way of chmodding the txt file from within the PHP script.
     
    egdcltd, Jul 8, 2010 IP
  2. Snell

    Snell Member

    Messages:
    27
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    try to put the full path of sitemap.txt :)
     
    Snell, Jul 9, 2010 IP