Latest advice taken from [[https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-lamp/]]\\
**Note:** this advises dumping mysql for [[https://mariadb.com/|Mariadb]]\\

Login as root
<code>
sudo su
</code>
===Install the database===
Install MariaDB-server and client:
<code>
apt-get -y install mariadb-server mariadb-client
</code>
During the install, you will be asked to set the ''root'' password, do so..\\
Test the login to MariaDB with the ''mysql'' command
<code>
mysql -u root -p
</code>
To leave the MariaDB shell, enter the command ''quit'' and press enter\\

===Install Apache2 webserver===
<code>
apt-get -y install apache2
</code>
Browser to ''http://localhost'' and you should see the default login page\\

===Install PHP5===
<code>
apt-get -y install php5 libapache2-mod-php5
</code>
The code to restart in Ubuntu is
<code>
systemctl restart apache2
</code>
but in Linux Mint, it's
<code>
service apache2 restart
</code>
To test the PHP, put a simple PHP page in the webserver root
<code>
nano /var/www/html/info.php
</code>
then paste this code in and save (Ctrl-O)
<code>
<?php phpinfo(); ?>
</code>
Go to ''http://localhost/info.php'' and you see a huge page with info on the PHP. It's that simple and you've written your first PHP page..\\
Load a whole bunch of PHP addons which are needed for a lot of PHP software you'd probably install
<code>
apt-get -y install php5-mysqlnd php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
</code>
Restart ''apache2'' and use the ''http://localhost/info.php'' page to see the added stuff. Weirdly you might not see some like mcrypt which you have to further activate by
<code>
php5enmod mcrypt
</code>

=== Speed up PHP by installing APCu cache===
<code>
apt-get install php5-apcu
</code>
Restart ''apache2'' and you'd be done. See [[Configure a virtual website with apache2]] to make a local virtual website. Ignore the first install instruction there and continue with the rest..\\
=== Install phpmyadmin===
A very good web interface to create/modify your Mariadb database
<code>
apt-get -y install phpmyadmin
</code>
You'll be asked some questions\\
Web server to configure automatically: //Select  apache2//\\
Configure database for phpmyadmin with dbconfig-common? //Yes//\\
Password of the database's administrative user: //Enter the MariaDB root password//\\
MySQL application password for phpmyadmin: //Use your own or press enter, apt will create a random password automatically//\\
Web server to reconfigure automatically: //apache2//\\
