busillis Posted June 19, 2008 Share Posted June 19, 2008 I'm using WAMPSERVER The file that executes forever, will check the date, hour and minute from the system and send an automated message when date/hour/minute is the same criteria as the message itself. I've got the time,date,hour, etc stuff already sorted, but how can I have the php script continuosly run? Would it be possible to make Apache run it on start? Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/ Share on other sites More sharing options...
DarkWater Posted June 19, 2008 Share Posted June 19, 2008 I wouldn't do that if I were you....but whatever. Put it in its own folder and use set_time_limit(0) and use a .htaccess to make Apache not timeout. I really wouldn't do it like that if I were you though. O_O Why do you need to do this, by the way? Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-569542 Share on other sites More sharing options...
rhodesa Posted June 19, 2008 Share Posted June 19, 2008 you can use set_time_limit() to make the script never time out, and then run an infinite loop. but, it sounds like you just want something to run every hour? Am I right? If you are using Windows, just use the Scheduled Tasks to execute the script every hour Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-569544 Share on other sites More sharing options...
Ironphp Posted June 19, 2008 Share Posted June 19, 2008 I'm using WAMPSERVER The file that executes forever, will check the date, hour and minute from the system and send an automated message when date/hour/minute is the same criteria as the message itself. I've got the time,date,hour, etc stuff already sorted, but how can I have the php script continuosly run? Would it be possible to make Apache run it on start? From what I am understanding, you might want to look into cronjobs if your server supports enables you to do such a thing. Regards, Ironphp Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-569564 Share on other sites More sharing options...
rhodesa Posted June 19, 2008 Share Posted June 19, 2008 I'm using WAMPSERVER The file that executes forever, will check the date, hour and minute from the system and send an automated message when date/hour/minute is the same criteria as the message itself. I've got the time,date,hour, etc stuff already sorted, but how can I have the php script continuosly run? Would it be possible to make Apache run it on start? From what I am understanding, you might want to look into cronjobs if your server supports enables you to do such a thing. Regards, Ironphp if it's wampserver, it should be Windows...aka use Scheduled Tasks Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-569606 Share on other sites More sharing options...
busillis Posted June 20, 2008 Author Share Posted June 20, 2008 I will take a look at scheduled tasks... It's to send automated emails, for a given time. EDIT Just looked at scheduled tasks. Not quite sure on config for this, to make it run through WAMP server? ??? Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-570011 Share on other sites More sharing options...
rhodesa Posted June 20, 2008 Share Posted June 20, 2008 it won't run through the wampserver. it will be a PHP Command Line Interface (CLI) script. i assume wampserver installs the PHP executable, but not sure where exactly. once you find that executable, you can run scripts from the command line like so: c:\path\to\php.exe -f c:\path\to\phpscript.php and in your scheduled task, you would put the above command into the "Run" field Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-570070 Share on other sites More sharing options...
busillis Posted June 20, 2008 Author Share Posted June 20, 2008 Got it working, that's great. Thank you for all your help. One little thing: Each time it runs, a command prompt window appears, then closes. Is it possible to have this hidden / always minimised? Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-570092 Share on other sites More sharing options...
rhodesa Posted June 20, 2008 Share Posted June 20, 2008 Unfortunately, I have never been able to solve that issue. If you figure it out though, please share here! Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-570103 Share on other sites More sharing options...
rhodesa Posted June 20, 2008 Share Posted June 20, 2008 I Googled a bit and just found the answer...it's kind of weird, but it works: 1) Create a BAT file (I called mine run.bat) and put the line from before in it (here it is again): c:\path\to\php.exe -f c:\path\to\phpscript.php 2) Right click on the new BAT file and do Create Shortcut. Rename the new shortcut file to run.lnk 4) Right click the shortcut file and do Properties. In the Run field, select Minimized. 5) Have your scheduled task execute that shortcut file. Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-570108 Share on other sites More sharing options...
busillis Posted June 20, 2008 Author Share Posted June 20, 2008 Thanks Aaron, that's great! Quote Link to comment https://forums.phpfreaks.com/topic/110999-solved-make-a-php-file-execute-forever/#findComment-570205 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.