To start web development in PHP you need to install Apache, Php, MySQL, PhpMyAdmin installed on Linux machine. Here I am going to tell you how you can run your php website on Linux machine.
Before starting installation process you need to run update command.
sudo apt-get update
Install Apache Server on Machine
sudo sh -c "apt-get update -y; apt-get install apache2 -y; systemctl start apache2.service" Now if you will type localhost(if you did all previous steps on local machine) or type public IP(if you have done installation process on server) on your browser, if you see a default apache server page there then it means you have installed apache successfully.
sudo apt-get install php php-curl php-xml libapache2-mod-php php-mysql php-mbstring php-gettext php-fpm
Install MySQL Client
sudo apt-get install mysql-server mysql-client
See all message carefully when it is installing. It will ask to set password. Select password policy like whether your to keep password weak or high etc.
Check whether you have configured mysql successfully or not.
sudo mysql -u root -p
It will ask to type your root password. After giving your root password you will be able to run sql queries.
If you not comfortable with sql commands and cli terminal for sql queries, then you can handle it with phpmyadmin where you can create database, tables with UI.
sudo apt-get install phpmyadmin
And at last restart apache-server
sudo systemctl restart apache2
Now if you will type localhost/phpmyadmin(if you did all previous steps on local machine) or type publicIP/phpmyadmin(if you have done installation process on server) on your browser, if you see phpmyadmin login page there then it means you have installed phpmyadmin successfully.
Now all LAMP set up has been configured on you machine.
Now if you want run your website then you need to put all your file and folders in /var/www/html/ directory.
Make sure that you have deleted all existing files and folders in /var/www/html/ and you have put your website’s index file in /var/www/html/ directory to run your website. Whenever user hit your website’s url, server finds index file in your root(/var/www/html/) directory.
Now I hope you can run a php website using Apache PHP MySQL and PhpMyAdmin on Linux machine.