The Wayback Machine - https://web.archive.org/web/20240701194531/https://www.geeksforgeeks.org/how-to-install-php-on-linux/
Open In App

How to Install PHP on Linux?

Last Updated : 06 Dec, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

PHP is a general-purpose scripting language that is especially used in web development. It was created in 1994 by Rasmus Lerdorf. It is used to manage dynamic content, databases, session tracking, and build entire e-commerce websites and Linux is an open-source operating system. It was first released on  17 September 1991  by Linus Torvalds. In this article, we will know that How can we install PHP on Linux operating system.

Prerequisites:

  • An ANSI C compiler.
  • Module-specific components like GD graphics libraries or PDF libraries.
  • Optional: Autoconf 2.59+ (for PHP versions < 7.0), Autoconf 2.64+ (for PHP versions > 7.2), Automake 1.4+, Libtool 1.4+, re2c 0.13.4+, and Bison.

Installing PHP on Linux:

Follow the below steps to install PHP on Linux:

Step 1: Open your terminal in Linux

On your Linux computer open the terminal. You can also open the terminal by using Ctrl+Alt+T.

 terminal in Linux

Step 2: Update your packages

On your terminal update your packages using the following command.

#    sudo apt-get update

updating packages

Step 3: Upgrade your packages

Now install available upgrades of all packages currently installed on the system using the following command.

#    sudo apt-get upgrade

upgrading packages

Step 4: Install PHP

Now we are ready to install PHP. The following command will install PHP on our system.

#    sudo apt-get install php

installing php on linux

After entering the above command a prompt will appear enter Y and press enter key. Within few minutes the latest version of PHP along with several extensions will install on your Linux system.

You can verify the PHP version after installation using the following command.

#    php --version

verifying php installation on Linux

As you can see the output PHP version shown that means we have successfully installed PHP in our system.


Previous Article
Next Article

Similar Reads

How to Install WordPress on the Linux Apache MySQL and PHP stack ?
WordPress is one of the commonly used Content Management systems on the web. It is written in PHP web servers like Apache are enough to run it. WordPress supports MySQL and MariaDB, but MySQL is widely used. This tutorial will help you to run WordPress using the LAMP(Linux, Apache, MySQL, PHP) stack on your Linux machine (probably VPS). Prerequisit
8 min read
How to Install Eclipse For PHP on Linux?
Eclipse is a free open source platform, Integrated Development Environment (IDE) with the help of which applications are made using the Java programming languages and other programming languages are also used such as C/C++, PERL, Python, Ruby, etc. It is composed of many plug-ins and is designed to be extensible using additional plug-ins. Installin
1 min read
How to Install imap extension in PHP on Linux?
The Internet Message Access Protocol (IMAP) is an application layer protocol that allows a client to efficiently access emails from anywhere. It stores email on the server and can download on-demand. It is like an intermediary between client and email servers. It was designed by Mark Crispin in 1986 as a remote access mailbox protocol and the curre
3 min read
How to Install Imagick for PHP in Linux?
Imagick is a PHP ImageMagick extension. It is a native PHP extension to create and modify images using the ImageMagick API. It is used to read, write, and convert the images in any formats including, EXR, GIF, JPEG, PDF, PNG, PhotoCD, TIFF, etc. In this article, we will learn how to install Imagick for PHP in Linux. Prerequisite: PHP should already
2 min read
How to Install and use PHP Composer on Linux?
A composer is a tool that is used for dependency management in PHP. But Composer is not a package manager. Composer is an application-level manager that is completely used for PHP programming language. A package manager is used to import codebases into the project and make it up to date. Composer helps to declare necessary libraries and dependencie
3 min read
How to Install PHP on Alpine Linux?
Alpine Linux is a Linux distro that is lightweight and security-focused. The main aim of alpine is to be minimalistic be it in scope or space. Since it is small in size it is used in those containers which require less time for booting. Unlike other distros which use GNU, Glibc alpine used musl, busybox. PHP is a general-purpose, server-side script
2 min read
How to Install GD module on Linux?
GD is a python library. It provides various features and an async-ready API wrapper for the geometry dash. It is easy to use. It is used to implement the geometry dash API and is also very handy to work with object-oriented design. Installing GD module on Linux Method 1: Using pip to install GD Package Follow the below steps to install the GD packa
2 min read
How to Install Kali Linux on Windows?
Kali Linux is an open-source Linux distribution based on Debian, designed for sophisticated penetration testing and security auditing. Kali Linux includes hundreds of tools for diverse information security activities such as penetration testing, security research, computer forensics, and reverse engineering. This multi-platform solution is accessib
2 min read
How to install and configure Docker on Arch-based Linux Distributions(Manjaro) ?
In this article, we are going to see how to install and configure Docker on Arch-based Linux Distributions. Docker is an open-source containerization platform used for building, running, and managing applications in an isolated environment. A container is isolated from another and bundles its software, libraries, and configuration files. Containers
2 min read
Install Pytorch on Linux
In this article, we are going to see how you can install PyTorch in the Linux system. We are using Ubuntu 20 LTS you can use any other one. To successfully install PyTorch in your Linux system, follow the below procedure: First, check if you are using python’s latest version or not. Because PyGame requires python 3.7 or a higher version, make sure
2 min read
three90RightbarBannerImg