I have a hosted a website in free hosting site ,I am new to web programming.Now what i want to do is a want a php
file to run on the server side continuously 24*7 and fetch the data from spreadsheet(i have php
file which does this job) ..In the process i want a file on the server to b replaced so that it can act as the data source to the referring clients.
Asked
Active
Viewed 121 times
-2

Cœur
- 37,241
- 25
- 195
- 267

Sundar Rama
- 1
- 2
2 Answers
1
Instead of running a script continuously on the server, it is good to use Cron Jobs in PHP.
If you're on shared hosting, add similar line in cron job list,
/usr/bin/php -q /home/<hosting-username>/public_html/path-of-php-script
Here, You can run the php file with some seconds/minutes/hours/days/weeks/months/years interval.
0
php will always be running as long as a site has been pulled from the server, and it contains php. The connection will be closed once one closes the page.
As I understand your question you can do a couple things.
The easiest would be to just set a cron job if your web hosting supports it.
How to create cron job using PHP?
managing-cron-jobs-with-php--net
-
basically i am just using only the backend.I am connecting to the file present there using android.I want this file to have updated version of the spreadsheet .so i need to replace it.Hope cron tab works...Thank you :) – Sundar Rama Jul 25 '15 at 11:02