Assuming you’re going for a LAMP setup, which is Linux, Apache, MySQL and PHP, and have followed some of my other blog posts, we’re at the point where you might find out that PHP isn’t installed on Ubuntu 18 on most hosting solutions. Hopefully this quick guide will get you started.
sudo apt install php libapache2-mod-php php-mysql
Follow the on-screen instructions, accept Y for yes when asked to install additional stuff.
Next, we wish to give priority to loading index.php over index.html, so edit the following file with nano, and in front of index.html type index.php, then go further down the line and remove index.php from the list there.
sudo nano /etc/apache2/mods-enabled/dir.conf
It should look like this probably:
<IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm </IfModule>
If you run XenForo or something else, you might wish to install additional required modules:
sudo apt install php-cli php-curl php-gd php-xml php-zip
Don’t forget to restart the Apache2 web server to get everything started.
sudo service apache2 restart