0

I am using RabbitMQ Messaging service to run some background services. The problem I am facing is that I have keep open my command line which runs a script continuously

php receive_messages.php

Is it possible that these scripts run in background as soon as I start my rabbit MQ server or WAMP?

In linux I can use some programs like forever but in windows ???

pinepain
  • 11,124
  • 1
  • 53
  • 62
Niraj Chauhan
  • 6,765
  • 9
  • 41
  • 73
  • Duplicate. http://stackoverflow.com/questions/298562/windows-xp-or-vista-how-can-i-run-a-batch-file-in-the-background-no-windows-di ( and a bit http://stackoverflow.com/questions/415409/run-batch-file-as-a-windows-service) – pinepain Feb 05 '14 at 08:51

1 Answers1

0

Try running a PHP script in a while loop and run in with screen.

Example code:

#!/usr/bin/php
ignore_user_abort(true);    
set_time_limit(0); 

while(true) { 
   echo 'Running..'; // Code here
   sleep (60); // Sleep 60 seconds
}

Command for cmd (first start cmd by pressing alt + r and then type cmd) with:

start /B php.exe myscript.php 
Youri
  • 453
  • 3
  • 18