How to Install PHP on Linux?
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.
- 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.
Step 2: Update your packages
On your terminal update your packages using the following command.
# sudo apt-get update
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
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
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
As you can see the output PHP version shown that means we have successfully installed PHP in our system.