On 9/17/07, Rodolfo De Nadai <rodolfo.denadai@xxxxxxxxxxxxx> wrote: > Hi all... > > I'm facing a serious problem with my application. I have a script write > in PHP that starts in Internet Explorer, this script keep on running > until a varible value change on my MySQL database. > The problem is that when i restart Apache, the process child initalized > isn't kill... then the apache can't be start because the script is use > the port 80. Hi Rodolfo- I think you are going about this the wrong way. You shoud not have the PHP script itself execute the forever running task, it should just trigger the separate starting/stopping of the task. There are several ways to do this, the first two that spring to mind are: 1. Create a custom init-script in /etc/init.d (or wherever your distribution has init scripts) that the PHP process triggers with a start command (/etc/init.d/myprog start). This will require root privileges for the PHP process (or no-password sudo privileges for that command). --or-- 2. Have a cron job running as a user that has appropriate permissions. This cron job should look for the presence of specific files - if it sees them, it takes the appropriate action, and then deletes the trigger file. For example, have the cron job watch for the presence of /tmp/startMyProg.marker - when it sees it, it starts the program and deletes /tmp/startMyProg.marker. Also have it watch for the presence of /tmp/stopMyProg.marker, when it sees that, it would stop the running program, and delete the marker file. At this point, all your PHP script has to do is create the appropriate file in /tmp (could be as simple as a exec("touch /tmp/startMyProg.marker") call). Hope that sends you a workable direction- James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php