SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot m0h's Avatar
    Join Date
    Sep 2001
    Location
    Cairo, Egypt
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Command Line PHP on Windows XP

    hi,

    I'm running a php script from the command line on my windows computer, I'm using this to run it:
    php "c:\phpd\www\file.php" > log.txt

    Its working as I wanted except that the output is only saved in the log.txt file when my script is stoped, what I want is to have the output saved in log.txt in real time as what happens when I run the same script on a linux box.
    - m0h

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    Michigan, USA
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, that's pretty interesting. Did you try actually taking in the file name as a parameter and opening the file rather than output redirection? That might be a place to start.

    Just throwing something out there Good luck with your problem!

  3. #3
    SitePoint Zealot m0h's Avatar
    Join Date
    Sep 2001
    Location
    Cairo, Egypt
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So u mean I'll have to write my own function that will print to a file instead printing to the screen?
    - m0h

  4. #4
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you sure that the file is not being written ? it should be , PHP should not cache writes.

    how are you coming to the conclusion that the file is not being written ? by looking in explorer ? , try writing another PHP script which reads the file in (looping till the file exists (remember to use clearstatcache() ! ) and then streaming that to a command window , eg I think its just XP or internal PHP caching thats obfuscating the existance of the file

  5. #5
    SitePoint Zealot m0h's Avatar
    Join Date
    Sep 2001
    Location
    Cairo, Egypt
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found that file is not being written by simply trying to open it, It has no data in it till I stop the php script.
    - m0h

  6. #6
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    Michigan, USA
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    m0h - That would be my recommendation. See if that can make it work out right. It's kind of weird that it doesn't work as is, so I'm throwing you a weird suggestion


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
  •