سؤال

I'm trying to create a daemon to run in the background and every n number of seconds execute php code like: queries.

The reason i need this daemon is because I am building a website there are 2 types of users. Providers and Consumers. The providers can provide specific services( like cleaning, painting..) and the consumers post offers asking for this services on there profile.

My goal is to have a daemon running in the background and match consumers with providers that provide services the consumer is asking for and displaying this matches in the form of suggestions.

I've tried to learn about daemons that serve this kind of purposes put I did't managed to learn much.

I managed to install PEAR and System_Daemon by following this tutorial:

http://kvz.io/blog/2009/01/09/create-daemons-in-php/

I tried to make a file in my server's web directory (the directory i have my website that I'm working on but when i open the .php file I've created through my browser it does nothing

The code in the test.php file is the following :

<?php require_once "System/Daemon.php";    // Include the 
ClassSystem_Daemon::setOption("appName", "mydaemon");  // Minimum configuration
System_Daemon::start();                           // Spawn Deamon!

?>

I'm sure that the include_once works and also the ClassSystem_Daemon::setOption("appName", "mydaemon"); because i tried commenting out System_Daemon::start(); and putting an echo command under that code. with the System_Daemon::start(); command comment out the echo appeared

Anybody that has any suggestions or any information that can guide me through?

هل كانت مفيدة؟

المحلول

The daemon has to be started on CLI, not via the web browser.

You're really better off with a cronjob.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top