How to keep process running after apache restart.

I have posted this on the Web subforum but it seems that nobody knows to do this, maybe someone has a solution here. Thank you

I have a PHP application that starts a couple of processes on the server...the problem is that if I restart apache those running apps will die.

How can I start them in a way that they are not killed when I restart/stop apache ?

      $cmdstr = "nohup ".$config['hsp_path']."/".$config['sc_trans']." ".$config['hsp_path']."/autodjs/".$port."/".$srvname.".conf";
      $cmdstr .= " > /dev/null & echo $!";
      $pid = shell_exec($cmdstr);

This is how I start that app.

run it outside of apache. Write the front-end to update a file or database and have another job monitor for that and then start the job. Starting applications under apache is not recomended.