in reply to Stop apache server

If you are using Linux platform, use the following suggestion.

You can generate a signal TERM to the parent process using kill function in Perl. If you want to restart the process, send a HUP signal.

Further more information please gone through here.