How to Install PHP on Ubuntu 18.04


Easily deploy your favorite applications in seconds at an unbeatable price for your next projects.

Installing PHP on Ubuntu 18.04

PHP is a popular server-side scripting language used for web development. It allows you to create dynamic and interactive web pages by embedding PHP code into HTML.


To install PHP on Ubuntu 18.04, you can follow these steps:

Step 1: Update System Packages

Before installing PHP, it's always a good idea to update your system packages to the latest version. Open a terminal and run the following command:

sudo apt update

Step 2: Install PHP

Once you've updated the system packages, you can install PHP by running the following command:

sudo apt install php libapache2-mod-php

This command will install PHP along with the Apache module required for PHP integration.

Step 3: Verify PHP Installation

After the installation is complete, you can verify if PHP is properly installed by creating a test file. Create a file named "info.php" in your default web directory:

sudo nano /var/www/html/info.php

Add the following PHP code to the file:

Save and close the file. You can access this file from your web browser by visiting http://localhost/info.php. If PHP is installed correctly, you should see a page displaying PHP information.

Step 4: Configure PHP Settings (optional)

By default, Ubuntu 18.04 uses a basic PHP configuration. If you need to customize PHP settings according to your requirements, you can edit the PHP configuration file located at /etc/php/7.2/apache2/php.ini. Make the necessary changes and restart the Apache web server for the changes to take effect:

sudo systemctl restart apache2

That's it! You have successfully installed PHP on Ubuntu 18.04.

Refer A Friend
Get $25

Installing PHP on Ubuntu 18.04
PHP installation on Ubuntu 18.04
PHP on Ubuntu 18.04
PHP setup on Ubuntu 18.04
Ubuntu 18.04 PHP installation
Ubuntu 18.04 PHP setup
how to install PHP on Ubuntu 18.04
step-by-step PHP installation on Ubuntu 18.04
PHP installation guide for Ubuntu 18.04
Ubuntu 18.04 PHP configuration.

Why Customers Love Us

What our customers say about us

Ready To Get Started For Free?

Create your free account today.