Jump to content

creating win32 sercice in PHp


sunilvadranapu

Recommended Posts

it is very urgent could any one respond to this. Actually i have a php script. I want to run that as a windows service (like a deamon in Linux). I have tried the sample code

if ($argv[1] == 'install') {

$x = win32_create_service(array(

'service' => 'dummyphp',

'display' => 'sample dummy PHP service',

'params' => __FILE__ . ' run',

));

debug_zval_dump($x);

exit;

} else if ($argv[1] == 'uninstall') {

$x = win32_delete_service('dummyphp');

debug_zval_dump($x);

exit;

} else if ($argv[1] != 'run') {

die("bogus args");

}

 

$x = win32_start_service_ctrl_dispatcher('dummyphp');

 

while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {

usleep(250000);

}

 

 

but i didnt get full idea with this. could any one explain this code?

what happens when i install, uninstalll, start the service and stop the service. wht part of code will be executed correspondingly to the above events.

 

with the above code, i am able to create a service but couldnot run it. when i start teh service i am getting error 1053:

 

how to handle start event., stop event how to continuosly check for stop evnt after starting the service

 

please help me to get clear picture on it

 

Thanks in advance

 

-SunilKumar V

Urgent requests will not get you anywhere fast. People put their own freee time into this community, they do not get paid so don't expect a radical response. Although our response is usually fast, a reply within the first couple of minutes. However this varies depending on the thread and who's online at the time.

 

Please wait at least 8 - 12 hours before bumping the thread. If you get no replies then more likely no one knows how to answer your question.

ok, thanks for you reply. atlest you mailed something.  Actually i have to submit my pjt report in that hurry i mailed like that. As i am in hurry, and waiting for reply from long time(days), i mailed that. Apart from that i know rules of the forum.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.