To check if Apache2 service is running, simply run the following command:
sudo service apache2 status
To check if MySQL service is running, simply run the following command:
sudo service mysql status
For CentOS or Fedora:
To restart the service:$ sudo systemctl restart httpd
And
To check the service status:$sudo systemctl status httpd