How To Install PHP In Linux

How To Install PHP In Linux

Today’s topic is about How To Install PHP In Linux. In the last article, I showed you how to install PHP or XAMPP in Windows operating systems. And it was super easy. In this article, I’ll show you how to install PHP (LAMP) in Linux operating system. It’s really very simple to create a PHP environment in Linux. So let’s get started.

How-To-Install-PHP-In-Linux

How To Install PHP In Linux

Before we start talking about installing PHP in Linux, you should know what is LAMP.

What is LAMP?

LAMP stands for Linux, Apache, MySQL, and PHP. It’s really very simple to install PHP, a web server, a database system, and PHP in a Linux box with LAMP. So let’s see how we can install it.

How to install LAMP in Linux?

You can tasksel to install LAMP. Tasksel is a package that provides many packages built-in. So we’ll first install tasksel and then run it to install LAMP.


For the purpose of this article, I’m using Ubuntu. So all commands will work if you’re using any Debian based Linux. But, if you’re using Fedora or any RPM-based Linux, simply use your distribution package manager to install the package. For example, if you’re using Fedora, you can use the DNF package manager followed by the package name.

Install tasksel

run tasksel install lamp server in ubuntu with tasksel
installing lamp using tasksel
localhost server is running

For Debian based Linux –
sudo apt install tasksel
For Fedora Linux –
sudo dnf install tasksel
When the installation is done, simply run the tasksel with sudo.
sudo tasksel

And the installation will start.

That’s it! You’re done. You’ve successfully installed Apache, MySQL, and PHP in your Linux distribution. You can confirm the installation by going to localhost in the browser.

If you see the above page, then you’ve installed LAMP and the server is up and running.

Conclusion

Creating a PHP environment is the first step in web development in PHP. You can now install your favorite code editors and start coding in PHP.

Read more