anf134
anf134

Reputation: 11

PHP program always active in web-server

Is it possible? E.g. A script every minute write a word in a file (without the page opened in a browser).

Upvotes: 1

Views: 210

Answers (4)

Andrey
Andrey

Reputation: 60075

This is kind of job definitely not for web server. The job for web server is to invoke your script on request from the web. PHP engine can run autonomously, without server. You can run it: /usr/bin/php -f yourscript.php, on Windows repace beginning with your php.exe path. Then use cron to schedule execution

Upvotes: 0

aularon
aularon

Reputation: 11110

You can execute php from the command line, in this case your scripts executes regardless of server/browser, you can use a for loop, combined with sleep to achieve what you described.

Upvotes: -1

sprain
sprain

Reputation: 7672

You can accomplish this with a cronjob.

Get some detailed info here:
http://service.futurequest.net/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=30

Plus you might want to ask your hoster how you can add cronjobs on your particular server.

Upvotes: 1

NullUserException
NullUserException

Reputation: 85468

Yes, you'd need to set up a cron job that runs regularly (eg: every minute).

Upvotes: 5

Related Questions