I thought it would be nice to have a small howto on installing Apache2 MariaDB and PHP7 on this community. So here we go.
We will use MariaDB here instead of MySQL. MariaDB is a fork of MySQL and has some nice new features.
The order will be install the database-server, install apache2 and then do the actual install of PHP.
The commands will be issued as root so first we do a sudo su -
sudo su -
apt-get -y install mariadb-server mariadb-client
mysql_secure_installation
apt-get -y install apache2
apt-get -y install php7.0 libapache2-mod-php7.0
systemctl restart apache2
Baisc PHP is now installed, we will now install the extras. The following command is one line so copy and paste all the text below.
apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick \
php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 \
php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext
Let’s speed up PHP using a cache and restart Apache2
apt-get -y install php-apcu
systemctl restart apache2
And finally we install PhpMyAdmin and make it working with MariaDB.
apt-get -y install phpmyadmin
echo "update user set plugin='' where User='root'; flush privileges;" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
Source: https://www.howtoforge.com/tutorial/install-apache-with-php-and-mysql-on-ubuntu-16-04-lamp/