Install Apache

Introduction

This guide helps install a LAMP stack on an Ubuntu 16.04 server, fulfilling the first requirement of a Linux operating system for hosting dynamic websites and web apps with Apache, MySQL, and PHP.

Step 1 — Installing Apache and Adjusting the Firewall

Apache is a widely used web server globally. It’s well-documented and a top choice for hosting websites. Installing it on Ubuntu is easy with the package manager, apt. This tool lets us install software hassle-free from Ubuntu’s repository. To begin, use these commands:

sudo apt-get update
sudo apt-get install apache2

Example 1: Half Pyramid of *

*
* *
* * *
* * * *
* * * * *

C Program

#include <stdio.h>
int main() {
   int i, j, rows;
   printf("Enter the number of rows: ");
   scanf("%d", &rows);
   for (i = 1; i <= rows; ++i) {
      for (j = 1; j <= i; ++j) {
         printf("* ");
      }
      printf("\n");
   }
   return 0;
}

hsbhdbshdsbdsdjs

0 1 1 2 3 5 8 13 21 34  
Here, 0 + 1 = 1  
            1 + 1 = 2  
            3 + 2 = 5

Code

<?php
$num = 0;
$n1 = 0;
$n2 = 1;
echo "<h3>Fibonacci series for first 12 numbers: </h3>";
echo "\n";
echo $n1 . " " . $n2 . " ";
while ($num < 10) {
    $n3 = $n2 + $n1;
    echo $n3 . " ";
    $n1 = $n2;
    $n2 = $n3;
    $num = $num + 1;
}
?>

 

Leave a Reply