0

Involved in automation project, I have a PHP file which inserts raw-data in MySQL database. I need the PHP file to run 24x7 even i am offline to collect the real-time raw-data to be stored for future analysis.

How to run the PHP file continuously in background...? Need steps and where to make changes in web-server..?

  • 1
    How about a cron job? Have you ever heard about it :) – chandresh_cool May 25 '15 at 10:48
  • Ya i heard..which location,to use the command. – Sunface.in May 25 '15 at 10:50
  • Use cron job as chandresh suggest – Prafulla May 25 '15 at 10:50
  • 1
    As Suggested use Cron Jobs - you set them up from your server management – Lupin May 25 '15 at 10:51
  • Depends which Server you are using, if Linux use crontab and if Windows use Task Scheduler. – chandresh_cool May 25 '15 at 10:52
  • I am having a .xls file, which is an output of a PLC circuit. I upload the excel file to a remote server every 1 second using filezilla. Then, using a PHP file extracting the excel raw-data and storing in a MySQL database. In future, generate the report from MySQL database. So, I need the PHP file to run continuously with time interval of 1 second. where to add cronjob in filezilla..? – Sunface.in May 25 '15 at 11:02

2 Answers2

0

You can use cron job for your problem this can be used for background process. use the below link http://docs.phplist.com/CronJobExamples.html

Anns
  • 21
  • 3
  • Thanks for replying, i am using filezilla to upload and can any one suggest in which file i need to add the cron job command or code..i see files like .htaccess. – Sunface.in May 25 '15 at 10:55
  • Please quote the relevant information from your link and then cite it as a source. All the information needed to resolve the question should be in your answer. – SuperBiasedMan May 25 '15 at 10:56
  • I am having a .xls file, which is an output of a PLC circuit. I upload the excel file to a remote server every 1 second using filezilla. Then, using a PHP file extracting the excel raw-data and storing in a MySQL database. In future, generate the report from MySQL database. So, I need the PHP file to run continuously with time interval of 1 second. where to add cronjob in filezilla..? – Sunface.in May 25 '15 at 11:00
0

forget the web, if you want a process always running you have to use cli-php. Basically you need a supervisor daemon that execute you php job and keep it alive in case of exit.

I like S6 but there are many: supervisord, runit, even systemd

m47730
  • 2,061
  • 2
  • 24
  • 30