How to install Apache2 MySQL and PHP7 on 16.04

software
networking

#1

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/


Tips, Tutorials and Guides Index
#2

Thank you! I am running Ubuntu Mate 17.10 with latest updates, these commands almost work, you have to change the php from php-7.0 to php-7.1 to work.


#3

hi don do you know if this tutorial will work on mate 18.04
i’m not good with linux but would like to it , it worked on my system mate 16.04.
any advice will be appreciated