It has been a day to day activity to restart Apache when ever there is any change in its configuration files or while changing in php.ini files.
But what if someone is viewing our site while we want to restart to make new changes effective. This definitely gives a bad experience to the end users. I wanted to see the changes without restarting the Apache server. I Googled and found the command i.e. reload. What it does is reloads any configuration changes without restarting Apache. Really cool. Now I am armed with one more command.
sudo service apache2 reload
But there is a caveat to this. The Apache server will stop if there is syntax error in configuration file. So we need to check it first with
sudo apachectl configtest or sudo apachectl -t
Now the order of my commands when I make any changes are
sudo apachectl configtest or sudo apachectl -t sudo service apache2 reload or apachectl graceful sudo service apache2 restart sudo service apache2 stop sudo service apache2 start