PHP - Installation on Linux Based Operating System

PHP - Installation on Linux Based Operating System

PHP Tutorials by shriekdj Series

ยท

2 min read

So I Will Try to Make Series About the PHP.

PHP is an Scripting language Majorly Used for Back-end Web Development and also more than 50 % websites on internet use PHP as back-end.

Development Environment on Linux

One of the most common server configuration for linux is LAMP stack (Linux, Apache, MYSQL, PHP).

For Linux we will try to install apache, MySQL separately and try not to install third party applications.

You can still install XAMPP if you prefer, but remember in production you should not try third party applications.


Check System updates of Linux

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist -upgrade
  • Here sudo is for superuser ( as a linux user you may already know it ).
  • Here all packages and whole operating system is being updated and upgraded.

Installing Apache Server On Linux

sudo apt-get install Apache2
  • We Use apache server for running our site under localhost

Installing MySQL on Linux Based Operating System

sudo apt-get install mysql-server

sudo my_sql_secure_installation.
  • It will ask to create database password so Create an Secure Password.

Start an Apache Server On Linux

sudo service apache2 start

You will get the below image on screen.

apache2-ubuntu-default-page.png


Start MySQL through another terminal simultaneously

sudo mysql -u root

Image Given Below

MySQL Starting Commands In Ubuntu Terminal


Now Actually Installing PHP on Linux Lol ๐Ÿ˜‚

sudo apt-get install PHP

This command will install PHP with it's default settings, so you will need to locate the PHP.ini file which can be located at /etc/PHP/8.1/apache2 and also in etc/PHP/8.1/cli.


Installing and Configuring phpmyadmin in Ubuntu / Linux

if you want PhpMyAdmin for setting up and making or altering your database in much more flexible way, you can use following commands.

sudo apt-get install PHPmyadmin

You Will also need to Configure apache to include phpmyadmin with following command.

sudo echo -e "\include etc/PHPmyadmin/apache.conf" >>/etc/apache2/apache2.conf

This is how you are ready to execute and run PHP programs on Linux.

Thanks for reading give your thoughts in the comments.

Bye ๐Ÿ‘‹.

Did you find this article valuable?

Support Shrikant Dhayje by becoming a sponsor. Any amount is appreciated!

ย