How To Install Apache PHP MySQL Server Stack On Ubuntu 18.04

Apache PHP MySQL Ubuntu

If you are a beginner server admin, you may be confused with a lot of steps you need to do in order to set up a new web application, using Apache Httpd, combine with PHP and MySQL.

It's gonna be hard if you just started it, but if you follow these steps you can make your web application run in minutes.

The component we use, i don't think there's gonna be much different if you are using a slightly different version.
- Ubuntu 18.04 LTS
- Apache Httpd Server 2.4
- PHP 7.2
- MySQL 5.7

1. Login using SSH access
2. Preferably create new user with sudo privileges
3. Login SSH using those sudo user
4. Get the update from Ubuntu repo
sudo apt update

5. Install the update
sudo apt full-upgrade

If a reboot is required, then just reboot
6. Install Apache
sudo apt install apache2

7.Adjusting Firewall,
Lets just open port 22 for SSH and Port 80 and 443, because your server is gonna be visible to the public, if you expose all the port attacker can easily intrudes into your server and using your resource

sudo ufw enable
sudo ufw allow 22
sudo ufw allow 'Apache Full'

8. Install MySQL
sudo apt install mysql-server
sudo mysql_secure_installation

9. Install PHP
sudo apt install php libapache2-mod-php

10. The bridge (MySQL module for PHP) to connect between PHP and MySQL
sudo apt install php7.2-mysql

12. Activate the bridge
sudo phpenmod mysqli

10. Restart Apache
sudo service apache2 restart

11. I believe that's all
If you go to rename the /var/www/html/index.html to index.php and you can test by putting some PHP code with MySQL connection into it.

Now you are ready with your full stack server running Apache web server with PHP and MySQL database connection.

Apache is the free, easy to set up, yet  it's really secure and widely used and heavily maintained web server. It is the perfect full package web server for your need.

PHP is the easiest way you can start developing or if you are beginner want to learning a programming language. Connection to a database like MySQL is so much easier and no need anything then putting the username and password of your MySQL instance.

Comments

Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

How To Create Spring Boot Project Using Netbeans

How To Connect SSH Using PEM Certificate On Windows

Flutter Button With Left Align Text and Icon

How To Use React Ckeditor Upload File Image With Demo and Example Codes