How can the Apache server be restarted to apply changes after updating the PHP version?

To apply changes after updating the PHP version, the Apache server needs to be restarted. This can be done by using the command line to restart the Apache service. Alternatively, the server can be restarted through a control panel or by using a GUI tool.

// Restart Apache server to apply changes after updating PHP version
exec('sudo service apache2 restart');