How to install PHP on Ubuntu 18.04 or Linux

How to install PHP on Ubuntu 18.04 or Linux

What is PHP?

Its a programming language, PHP was officially launched in 1994 and designed by legendary programmer Rasmus Lerdorf and his team.

In this article We will discussed about installation guide, How to install PHP on Ubuntu 18.04 or setup PHP on Ubuntu 18.04 or Linux machine. Recent new PHP upcoming version 8.4 release date is initial months of 2021. Current version of PHP 7.4  which release on 28 Nov 2019 and supported till 2022. And about version PHP 8.0 it will support until 2024.

.

How to install PHP on Ubuntu 18.04 or Setup on Linux machine

There are two method to install PHP on Ubuntu machine

Method 1. How to install PHP on Ubuntu 18.04 (Linux) with MySQL
Method 2. Install PHP, MySQL and Apache server via package on Ubuntu 18.04

.

Method 1. How to install PHP on Ubuntu 18.04 (Linux) with MySQL

Step 1. Install apache

$ sudo apt-get install apache2
Copy

Press Y for conformation

Step 2. Install MySQL

$ sudo apt-get install mysql-serverCopy

Press Y for conformation

NOTE: before going forward secure mysql server and test, it working properly or not

Secure MySQL:

$ sudo mysql_secure_installation
Copy

Testing MySQL:

$ sudo mysql -u root -pCopy


Create database name:

$ Create database myfirstdb
Copy

Step 3. Install Php

$ sudo apt-get install php libapache2-mod-php
Copy

Test PHP

$ sudo nano /var/www/html/info.phpCopy

Paste following code:

<?php
phpinfo();
?>Copy

Step 4. Restart Apache server:

$ sudo systemctl restart apache2
Copy

Open the browser run this url

111.111.111.111/info.phpCopy

You will see output after this

.

Method 2. Install PHP, MySQL and Apache server via package on Ubuntu 18.04

Click here to download the complete package for the same.

.

Conclusion:

Newcomers and other programmers still think, PHP is not a good language. But this is not true.

Because:

  1. More over 60% website are using PHP as backend
  2. Big brands like Wikipedia, Facebook, Hootsuite using PHP even NASA using it.
  3. Nothing is perfect every language has its own capability just like human fingers. They are not all the same.
  4. Every backend language have their own features:

Like:

  • Speed: NodeJS
  • Faster development: Ruby
  • Secure: Java
  • High performance: C, C++, Rust
  • Data analysis: Python
  • All in one: PHP

Wanna know about:
PHP 8.0 vs PHP 7.4 and PHP 8.0 features performance benchmark – Click here
PHP 7.4 vs 7.3 PHP 7.4 vs 7.3 What is the PHP 7.4 benchmark and PHP 7.4 features?- Click here

.

Other latest blogs

Leave a Comment

Your email address will not be published. Required fields are marked *