SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why wont cron work on this PHP file?????

    Hey guys,
    I can execute a php script via my admin interface in a web browser.....

    However, the script will NOT work when I try to run it via cron.......

    this is the cron command:

    php /pathto/filename.php > /logfile.txt

    here is the output of the error it is generating....::

    Warning: copy(../html/index.html) [function.copy]: failed to create stream: Permission denied in /pathto/filename.php on line 57

    THis works with no probs via browser, error only occurs from cron....

    Please Help.

    cheers

  2. #2
    Now with customized title Jump's Avatar
    Join Date
    Sep 2002
    Location
    The Restaurant at The End of The Universe
    Posts
    1,423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, what is the CHMOD value of that file or directory? Is that really what the file looks like or do you have any /pathto/filename.php?this=that&that=this in the url?

  3. #3
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that is really what the file looks like.....there are no url vars.....

    I also changed permissions on files and directory to 777 just to be sure.....but it still gives the same error.......

    cheers

  4. #4
    SitePoint Zealot JordanTLClive's Avatar
    Join Date
    Feb 2001
    Location
    Las Vegas, NV
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the usernames on the files you are using... maybe its tweaking out if the usernames are different and whoever the cron job is running as doesn't have the level of permission they need to do what you are doing.
    -Jordan

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Location
    USA
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you need to include the shebang line at the start of your php script, eg:

    #!/usr/bin/php

    or whatever the path to your php executable happens to be.

    Also, try running it from the commandline to verify that it works properly in that environment.
    Thank God I'm not too early!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •