Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Location
    Virginia, USA
    Posts
    124

    Windows Server - Automatic PHP script runner thing

    Ok, this may sound like a stupid questions, but here it goes anyway. Is there a way on a windows server to automatically run a certian PHP script on a schedule? I need to run it for email escalations for a ticketing system.

    Thanks in advance.

  2. #2
    Join Date
    Jul 2004
    Location
    N29° 22.725' X W95° 6.452'
    Posts
    343
    You can use task scheduler however it is nowhere near as comprehensive as cron jobs but it will still work. You just have to make several entries for the same thing to have it run your task around the clock. Example: if you wanted a script to run once an hour you would need to have 24 of the same tasks scheduled.
    Last edited by mcarman; 12-20-2004 at 03:38 PM.

  3. #3
    Join Date
    Mar 2004
    Location
    Virginia, USA
    Posts
    124
    Ok, I understand that I can have a "task" that runs IE at certain times, but how would I run a particular script? Is there such a thing as a PHP console where I could run a script?

    Or what about using a .bat file? Is that possible?
    Last edited by zopheus; 12-20-2004 at 03:40 PM.

  4. #4
    Join Date
    Jul 2004
    Location
    N29° 22.725' X W95° 6.452'
    Posts
    343
    run the php.exe and give your file as a parameter.

    c:\>C:\php\php.exe myfile.php

    your php file can run sql or any other php function.

  5. #5
    Join Date
    Mar 2004
    Location
    Virginia, USA
    Posts
    124
    Ok thanks, I'll try that.

  6. #6
    Join Date
    May 2004
    Location
    Colorado
    Posts
    948
    yeah, like mcarman, you can execute your script by doing that.. which is known as CLI (command line interface) for php, it allows you to execute scripts in the command line
    if you want to make it easier you can also set an environment variable so that you dont have to type the path to php.exe every time you want to use it

    in system properties (right click> properties on my computer) click the advanced tab, then select environment variables. in the user variables there should be a PATH variable, if there isnt, create it. then in the value, you can add the path to your php directory, where php.exe is found

    this will let you simply type php.exe into your cmd prompt and it will execute php.exe with whatever paramaters you have, you can also add additional path values using a semi colon ';' separator

    hope that was useful to some extent


    Absolute Power, its the only way to roll!

Posting Permissions

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