A Step-by-Step Guide to Setting Up a LAMP Stack on Linux

Installing php with Apache&MySql in Linux Os

To run a simple PHP code on a Linux system, you'll need a web server with PHP support installed. Apache is a commonly used web server, and you can install PHP alongside it. Here's a step-by-step guide:

1: Install Apache and PHP

-Open a terminal

write following command on terminal 

sudo apt update









sudo apt install apache2







Press Y to continue Downloading..

sudo ufw allow in "Apache Full"








2:Install MySql

write following command on terminal

sudo apt install php libapache2-mod-php php-mysql






So installation is completed For Checking Enter Following command

php -v





Installation is Completed Succesfully.....

Now move on to run php code.....

3:Run php Code

Following command are use for make php file

sudo gnome-text-editor /var/www/html/first.php






This command make first.php file and open text-editor in which i write a php code and Save the Code...










Now open Firefox Browser and search 

localhost/first.php 













Finally php code is successfully run.......

Comments

Popular posts from this blog

A Guide to PHP, Apache, and MySQL Installation

Creating REST API using PHP