Hello,
I am Sr. software engineer have experience in web application development and also fixed these type issue like auto restart when apache(httpd) or nginx stop. Let me know when you want to fixed this issue.
I will write shell script to auto restart apache and mysql.
Thanks