How would you set up a local Apache server with PHP?

How would you set up a local Apache server with PHP?

The most common way for beginners is to install Apache on their computer, configure it, and then use it to serve a directory full of files. However, this is an incredibly slow process that wastes resources and can be both impractical and insecure. The reason for this is simple: both options are much more efficient…