If you are on macOS, please use this guide: https://phptherightway.com/mac_setup. If you are on Windows, then please use this guide: https://phptherightway.com/windows_setup.
We're using an Apache2 HTTP server but you can use an Nginx HTTP server if you have it installed on your machine already. Now, follow these simple steps to install PHP:
- Run the following commands to update the local packages on your Ubuntu server and install Apache2:
$ sudo apt update
$ sudo apt install apache2
- After installing Apache2, verify it with the -v option:
$ apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2019-08-14T14:36:32
You can use the following commands to stop, start, and enable the Apache2 service so that it always starts up when the server boots up:
$ sudo systemctl stop apache2
$ sudo systemctl start apache2
$ sudo systemctl enable apache2
You can use the following command to check the status of Apache2:
$ sudo systemctl status apache2
...